Skip to content

ISR - await props.searchParams with generateStaticParams with an empty array is causing a page error in prod mode #79465

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

Open
dskiba opened this issue May 21, 2025 · 0 comments
Labels
Dynamic Routes Related to dynamic routes.

Comments

@dskiba
Copy link

dskiba commented May 21, 2025

Link to the code that reproduces this issue

https://github.com/dskiba/next.js-isr-prod-bug

To Reproduce

  1. run yarn install && yarn run build && yarn run start
  2. go to any slug page; example - http://localhost:3000/1
  3. see error 500 page and error in terminal
⨯ [Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: 'DYNAMIC_SERVER_USAGE'

Current vs. Expected behavior

Current: receiving DYNAMIC_SERVER_USAGE error

Expected: searchParams should be empty

Provide environment information

perating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 21.6.2
  npm: 8.9.0
  Yarn: 1.22.17
  pnpm: 9.8.0
Relevant Packages:
  next: 15.4.0-canary.45 // Latest available version is detected (15.4.0-canary.45).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

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

Dynamic Routes

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

next build (local)

Additional context

Many hours later, I've found out that it is caused by a combination of generateStaticParams with an empty array and the async call of props.searchParams.

So, in dev mode,
OR with export const dynamic = 'force-static' instead of generateStaticParams with an empty array,
OR not accessing async searchParams
will work fine

@github-actions github-actions bot added the Dynamic Routes Related to dynamic routes. label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dynamic Routes Related to dynamic routes.
Projects
None yet
Development

No branches or pull requests

1 participant