Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next build fails for parallel routes w/ edge runtime #60917

Closed
aplr opened this issue Jan 20, 2024 · 2 comments · Fixed by #61173
Closed

next build fails for parallel routes w/ edge runtime #60917

aplr opened this issue Jan 20, 2024 · 2 comments · Fixed by #61173
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked

Comments

@aplr
Copy link

aplr commented Jan 20, 2024

Running next build in a project w/ parallel routes + edge runtime enabled results in a "no such file or directory default_client-reference-manifest.js" build error.

This issue happens since 4.1.0, builds were running through smoothly until trying to update.

This bug only appears when enabling the edge runtime. When the edge runtime is not enabled, the build does not fail.

Link to the code that reproduces this issue

https://github.com/aplr/next_parallel_routes_default_build_issue

To Reproduce

  1. Implement parallel routes w/ default.tsx fallback as described in the docs
  2. Turn on the edge runtime in your root layout.tsx
  3. Run next build
  4. Watch the build fail

Current vs. Expected behavior

Current: build error
Expected: no build error

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000
Binaries:
  Node: 21.5.0
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: 8.14.1
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

App Router

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

Build logs

> next_parallel_routes_default_build_issue@0.1.0 build
> next build

   ▲ Next.js 14.1.0

   Creating an optimized production build ...
 ✓ Compiled successfully
   Linting and checking validity of types ...
   Collecting page data ...
Error: ENOENT: no such file or directory, open '/next_parallel_routes_default_build_issue/.next/server/app/@modal/hi/default_client-reference-manifest.js'
    at readFileSync (node:fs:453:20)
    at evaluateInContext (/next_parallel_routes_default_build_issue/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/web/sandbox/context.js:375:50)
    at getRuntimeContext (/next_parallel_routes_default_build_issue/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/web/sandbox/sandbox.js:70:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /next_parallel_routes_default_build_issue/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1088:29
    at async Span.traceAsyncFn (/next_parallel_routes_default_build_issue/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/trace/trace.js:151:20) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/next_parallel_routes_default_build_issue/.next/server/app/@modal/hi/default_client-reference-manifest.js'
}

> Build error occurred
Error: Failed to collect page data for /hi/default
    at /next_parallel_routes_default_build_issue/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1258:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}
 ELIFECYCLE  Command failed with exit code 1.

NEXT-2241

@aplr aplr added the bug Issue was opened via the bug report template. label Jan 20, 2024
@aplr aplr changed the title Parallel Routes + Edge Runtime + next build "no such file or directory default_client-reference-manifest.js" next build fails for parallel routes w/ edge runtime Jan 22, 2024
@mattiaz9
Copy link

I can add that this issue started appearing since next@14.0.5-canary.41.
Rolling back to next@14.0.5-canary.40 will make the error disappear.

@ztanner ztanner added the linear: next Confirmed issue that is tracked by the Next.js team. label Jan 25, 2024
ztanner added a commit that referenced this issue Jan 26, 2024
### What & Why
Using parallel routes with edge runtime would cause a build error when
using a default segment, because edge runtime has special handling to
[read the client reference
manifests](https://github.com/vercel/next.js/blob/12c90405681cf4120e3fa7f3e10d9466f598f9bb/packages/next/src/build/utils.ts#L1543-L1555)
for these when determining if a page is static.

### How
In a similar fashion to how we exclude static checks on reserved pages,
I added similar handling for app pages.

Fixes #60917
Closes NEXT-2241
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants