You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CAUGHT: n [Error]: Dynamic server usage: Route / couldn't be rendered statically because it used headers. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
at c (/git/reproduction-app/.next/server/chunks/next-runtime.js:6:156144)
at d (/git/reproduction-app/.next/server/chunks/next-runtime.js:6:111686)
at i (/git/reproduction-app/.next/server/app/page.js:1:2373)
at ep (/git/reproduction-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134542)
Expected
The error (meant to be caught by next.js) is not emitted in the build logs
Although this bug doesn't affect the render of the page (static vs dynamic is still inferred correctly) it's difficult to debug unless you dig into implementation details of the framework itself.
The source of the error is difficult to pinpoint from the stack trace
The documentation that is linked in the error message is misleading.
Why This Message Occurred
You attempted to use a Next.js function that depends on Async Context (such as headers or cookies from next/headers) but it was not bound to the same call stack as the function that ran it (e.g., calling cookies() inside of a setTimeout or setInterval).
Based off of this explanation I believe that this exception was only meant to be seen by the user if it was not caught by the framework (probably because it was thrown outside of the callstack of the function that ran it (e.g., calling cookies() inside of a setTimeout or setInterval).
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
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 20.9.0
npm: 10.1.0
Yarn: 3.5.0
pnpm: 8.6.12
Relevant Packages:
next: 14.1.1-canary.70 // Latest available version is detected (14.1.1-canary.70).
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.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
No response
The text was updated successfully, but these errors were encountered:
Link to the code that reproduces this issue
https://github.com/ppiwo/reproduction-next-app
To Reproduce
npm i
npm run build
Current vs. Expected behavior
Current
Expected
Although this bug doesn't affect the render of the page (static vs dynamic is still inferred correctly) it's difficult to debug unless you dig into implementation details of the framework itself.
Based off of this explanation I believe that this exception was only meant to be seen by the user if it was not caught by the framework (probably because it was thrown outside of the callstack of the function that ran it (e.g., calling cookies() inside of a setTimeout or setInterval).
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 Available memory (MB): 16384 Available CPU cores: 8 Binaries: Node: 20.9.0 npm: 10.1.0 Yarn: 3.5.0 pnpm: 8.6.12 Relevant Packages: next: 14.1.1-canary.70 // Latest available version is detected (14.1.1-canary.70). eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.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
No response
The text was updated successfully, but these errors were encountered: