Open
Description
Link to the code that reproduces this issue
https://github.com/a463/next-date-now-cache-error
To Reproduce
- Clone the repo
- Run
npm run build
Current vs. Expected behavior
Currently the build throws:
Error: Route "/" used `Date.now()` instead of using `performance` or without explicitly calling `await connection()` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time
at a (.next/server/app/page.js:1:3890)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
Export encountered an error on /page: /, exiting the build.
⨯ Next.js build worker exited with code: 1 and signal: null
The reproduction is very minimal, it has a single route with a use cache
directive, it makes a request to a placeholder API and then renders a client component. The client components calls Date.now()
, the error is thrown despite the call being within a use cache
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Thu Oct 5 21:02:42 UTC 2023
Available memory (MB): 32768
Available CPU cores: 16
Binaries:
Node: 22.13.1
npm: 10.9.2
Yarn: 1.22.22
pnpm: 9.12.1
Relevant Packages:
next: 15.2.0-canary.76 // Latest available version is detected (15.2.0-canary.76).
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), next dev (local)
Additional context
No response