mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
fef6f82aba
When using imports from `next/headers` in a layout or page, `StaticGenerationBailout` will throw an error to indicate Next.js should fallback to dynamic rendering. However, when async context is lost, this error is uncaught and leads to a confusing error message at build time. This attempts to improve DX surrounding this error by linking out to a page that explains when it might happen. I've also tweaked `StaticGenerationBailout` to always throw a fully descriptive reason as opposed to just `DynamicServerError: Dynamic server usage: cookies` Closes NEXT-1181 Fixes #49373 --------- Co-authored-by: Lee Robinson <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>