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

"Filling a cache during prerender timed out" error while building the app with dynamic routes #75338

Open
ketchuup opened this issue Jan 26, 2025 · 0 comments
Labels
dynamicIO Related to dynamicIO.

Comments

@ketchuup
Copy link

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/dynamic-routes-in-dynamicio-kxp6zr

To Reproduce

  1. Open the provided link to CodeSandbox.
  2. Run pnpm run build.
  3. Observe the following error:
Error: Filling a cache during prerender timed out, likely because request-specific arguments such as params, searchParams, cookies() or dynamic data were used inside "use cache".
    at 6274 (.next/server/app/[slug]/page.js:1:3742)
    at Function.t (.next/server/webpack-runtime.js:1:127) {
  digest: 'USE_CACHE_TIMEOUT'
}
Error occurred prerendering page "/[slug]". Read more: https://nextjs.org/docs/messages/prerender-error
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.
Export encountered an error on /[slug]/page: /[slug], exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null

  1. Remove "use cache"; from app/[slug]/page.tsx.
  2. Run pnpm run build.
  3. Observe the following error:
Error occurred prerendering page "/[slug]". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Route "/[slug]" has a `generateViewport` that depends on Request data (`cookies()`, etc...) or external data (`fetch(...)`, etc...) but the rest of the route was static or only used cached data (`"use cache"`). If you expected this route to be prerenderable update your `generateViewport` to not use Request data and only use cached external data. Otherwise, add `await connection()` somewhere within this route to indicate explicitly it should not be prerendered.
Export encountered an error on /[slug]/page: /[slug], exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null

Current vs. Expected behavior

Expected behavior:

  1. /[slug] dynamic route should be rendered statically at build time or at data revalidation.
  2. params should not be request-specific argument as error tells.

Current behavior:

  1. next build tries to build /[slug] dynamic route, however, it gets Filling a cache during prerender timed out, ... error.
  2. params are request-specific argument.
  3. await params requires to use either "use cache"; or Suspense boundary.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Enterprise LTSC 2021
  Available memory (MB): 15734
  Available CPU cores: 12
Binaries:
  Node: 22.12.0
  npm: 11.0.0
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  next: 15.2.0-canary.27 // Latest available version is detected (15.2.0-canary.27).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

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

dynamicIO

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

next build (local)

Additional context

Overall, I have no idea how to do dynamic routes with dynamicIO enabled and without using a Suspense boundary.

My goal is to render all the routes statically at build-time, including dynamic ones (using generateStaticParams).
If there is no pre-rendered paged for requested dynamic route, I want it to be rendered on demand and cached for future requests.

@github-actions github-actions bot added the dynamicIO Related to dynamicIO. label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dynamicIO Related to dynamicIO.
Projects
None yet
Development

No branches or pull requests

1 participant