Replies: 1 comment 11 replies
-
|
Please try to build with |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I’m consistently getting a prerendering crash during production build with Next.js 16.0.8 (Turbopack) — the build stops with:
Error occurred prerendering page "/dashboard". Read more: https://nextjs.org/docs/messages/prerender-error Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error Error [InvariantError]: Invariant: Expected workUnitAsyncStorage to have a store. This is a bug in Next.js. at K (C:\apps\happsbi-dashboard\.next\server\chunks\ssr\[root-of-the-server]__092ddb26._.js:1:83546) at br (C:\apps\happsbi-dashboard\.next\server\chunks\ssr\[root-of-the-server]__092ddb26._.js:4:7769) Export encountered an error on /dashboard/page: /dashboard, exiting the build. Export encountered an error on /_not-found/page: /_not-found, exiting the build.It clearly says “This is a bug in Next.js”, and looks related to async context inside prerender / PPR / dynamic IO.
npm run dev works perfectly — no runtime errors.
npm run build fails consistently during prerendering.
Errors alternate between /_global-error, /_not-found, and /dashboard/reports/....
I already tried all known workarounds:
Added export const dynamic = 'force-dynamic' and fetchCache = 'force-no-store' to root layout.
Added custom app/not-found.tsx and app/global-error.tsx (with 'use client').
Split dashboard page into a server + client component (page.tsx + DashboardClient.tsx).
Verified that no headers(), cookies(), useRouter(), usePathname(), etc. are called from server components.
Despite this, the build still fails with the same InvariantError.
I'm waiting for your support, thank you
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions