Skip to content

Commit 44353e8

Browse files
docs: fix Cloud storefront troubleshooting, Node.js version warning, and variables set scope defaults [automated] (#16220)
* docs: fix documentation issues from triage inbox * Revise environment variable creation notes Updated documentation regarding environment variable creation and its default scope settings. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0a8ef6c commit 44353e8

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

  • www/apps/cloud/app

www/apps/cloud/app/deployments/troubleshooting/page.mdx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,21 @@ If your storefront build fails with a `build-failed` status but the build logs a
267267
- An outdated lockfile that is out of sync with `package.json`
268268
- Incompatible or missing dependencies in the monorepo
269269

270+
### Check for Storefront Root Directory Misconfiguration
271+
272+
If the storefront build fails immediately (within 1-2 seconds) with no build logs and you see file retrieval errors, the storefront root directory configured in your Cloud project may not match the actual location of your storefront in the repository.
273+
274+
To verify and fix the storefront root directory:
275+
276+
1. In the [Cloud dashboard](../../organizations/page.mdx), open your project and go to **Settings**.
277+
2. Check the **Storefront root directory** field and confirm it matches the actual path of your storefront in the repository. For example, if your storefront is at `apps/storefront`, the field should contain `apps/storefront`.
278+
3. If the path is incorrect, update it and save.
279+
4. Trigger a new deployment.
280+
281+
Refer to the [Projects](../../projects/page.mdx) guide for details on editing the storefront root directory setting.
282+
283+
---
284+
270285
### Check for Lockfile Mismatches
271286

272287
Cloud installs dependencies with a frozen lockfile to ensure reproducible builds. If your lockfile is out of sync with `package.json`, the dependency installation step may fail silently.
@@ -478,6 +493,38 @@ This is because Cloud does not currently support Node.js middlewares in Next.js
478493

479494
---
480495

496+
## Next.js Turbopack Workspace Root Error in Monorepos
497+
498+
If your Next.js 16+ storefront build fails with the following error:
499+
500+
```bash
501+
Error: Next.js inferred your workspace root, but it may not be correct.
502+
We couldn't find the Next.js package (next/package.json) from the project directory
503+
```
504+
505+
This occurs in monorepo setups where the storefront is in a subdirectory (for example, `/storefront`) but `node_modules` is installed at the monorepo root. Turbopack's default workspace inference looks for `next/package.json` relative to the storefront directory, but the package is installed at the monorepo root.
506+
507+
### Fix Turbopack Workspace Root
508+
509+
Set the `turbopack.root` option in your `next.config.ts` to point to the monorepo root:
510+
511+
```ts title="apps/storefront/next.config.ts"
512+
import path from "path"
513+
import type { NextConfig } from "next"
514+
515+
const nextConfig: NextConfig = {
516+
turbopack: {
517+
root: path.join(__dirname, ".."),
518+
},
519+
}
520+
521+
export default nextConfig
522+
```
523+
524+
Replace `".."` with the relative path from your storefront directory to the monorepo root. Commit the updated `next.config.ts` and push to trigger a new deployment.
525+
526+
---
527+
481528
## npm Cache Errors During Build
482529
483530
If your build fails with an error similar to:

www/apps/cloud/app/projects/prerequisites/page.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Note } from "docs-ui"
2+
13
export const metadata = {
24
title: `Prerequisites for New Projects`,
35
}
@@ -121,6 +123,20 @@ Medusa uses Node.js v24.x (LTS) to build storefronts. You can't override this ve
121123

122124
So, ensure that your storefront is compatible with Node.js v24.x.
123125

126+
<Note type="warning">
127+
128+
If your storefront's `package.json` has an `engines.node` field that restricts the Node.js version to a range that excludes v24.x (for example, `"22.x"`), the build will fail with a version incompatibility error. Update the field to accept v24.x, for example:
129+
130+
```json title="apps/storefront/package.json"
131+
{
132+
"engines": {
133+
"node": ">=22.0.0"
134+
}
135+
}
136+
```
137+
138+
</Note>
139+
124140
### Root Build Script
125141

126142
Your monorepo must have a `build` script that builds both the Medusa application and the storefront. Medusa executes this script during the deployment process.

0 commit comments

Comments
 (0)