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

[appdir] [next 13.1.2] build crashes because routes are prerendered with fake data in dynamic segments #45006

Closed
1 task done
raphaelbadia opened this issue Jan 18, 2023 · 5 comments · Fixed by #45015
Closed
1 task done
Labels
bug Issue was opened via the bug report template.

Comments

@raphaelbadia
Copy link
Contributor

raphaelbadia commented Jan 18, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

$ /private/tmp/reproduction-app/node_modules/.bin/next info

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64
Binaries:
  Node: 16.16.0
  npm: 9.1.2
  Yarn: 1.22.19
  pnpm: 7.23.0
Relevant packages:
  next: 13.1.3-canary.4
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0

✨ Done in 2.42s.

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://github.com/raphaelbadia/nextjs-appdir-prerenders-weird

To Reproduce

Hello,

I upgraded from next 13.0.6 to [email protected] yesterday and since then I cannot build anymore my project. Digging into the issue showed my that the pages with dynamic segments are now prerendered at build time with the dynamic segment name as a string.

To reproduce, simply clone and install my reproduction link, then run yarn build.

The build will fail.

Describe the Bug

When building, next will try to render the page with the param as an argument. For instance, it will prerender app/[todoId]/page.tsx with the params {todoId: "[todoId]"}.

I tried using export const dynamic = 'force-dynamic'; but it doesn't change anything.

Expected Behavior

Like in 13.1.1, it shouldn't fail the build.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@raphaelbadia raphaelbadia added the bug Issue was opened via the bug report template. label Jan 18, 2023
@remvn
Copy link

remvn commented Jan 18, 2023

The repository you provided is a default template. There may be a mistake here. Can you please edit the correct repository link?

@bogh
Copy link

bogh commented Jan 18, 2023

I am also experiencing this. I have a page with a dynamic path in app dir app/[locale]/page.tsx
Doing yarn build would crash with a prerendering error.: https://nextjs.org/docs/messages/prerender-error

@ijjk
Copy link
Member

ijjk commented Jan 19, 2023

Hi, export const dynamic = 'force-dynamic' not being honored has been corrected in the latest canary of Next.js v13.1.3-canary.5.

Note, it is expected that the page attempts being prerendered if this isn't present and generateStaticParams isn't present as otherwise we aren't able to analyze whether the path is static or dynamic during build.

@raphaelbadia
Copy link
Contributor Author

sorry for the wrong reproduction link, I have fixed it.

Thanks for the quick fix @ijjk !

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. 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 19, 2023
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants