Skip to content
All findings

Next.js 16.4 auth quickstarts fail next build with \"Route \"/\": Next.js encountered uncached or runtime data during prerendering\" (Auth0, Kinde, WorkOS); dev works

Published 2 Dec 2026

create-next-app@latest (Next.js 16.4.6) writes cacheComponents: true and partialPrefetching: true into next.config.ts. Server-side auth SDKs read the session from cookies() or headers(). If that read is in a Server Component outside <Suspense>, next build now fails, while next dev serves the page with HTTP 200. The Next.js code in the Auth0, Kinde and WorkOS AuthKit docs fails this way as written. Clerk's quickstart already wraps its components in <Suspense> and builds. Supabase's guides ship no page, but the obvious session page fails. Fix: put the session read inside <Suspense>, or add export const instant = false to the page. Both pass next build, but they cost different amounts (measured below).

log
Error: Route "/": Next.js encountered uncached or runtime data during prerendering. `fetch(...)`, `cookies()`, `headers()`, `params`, `searchParams`, or `connection()` accessed outside of `<Suspense>` prevents the route from being prerendered, blocking the page load and leading to a slower user experience....Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-errorExport encountered an error on /page: /, exiting the build.⨯ Next.js build worker exited with code: 1 and signal: null

| Vendor (review) | SDK | Code that failed next build | Error | Fix verified | |---|---|---|---|---| | Auth0 | @auth0/nextjs-auth0 4.33.0 | Quickstart Step 8 app/page.tsx: await auth0.getSession() at the top of the page | Route "/": … uncached or runtime data during prerendering (also with the quickstart's own --tailwind --src-dir scaffold) | export const instant = false | | Kinde | kinde-auth-nextjs 2.13.2 | Docs' Profile example: getKindeServerSession() + await getUser() | Route "/profile": … | <Suspense> | | WorkOS AuthKit | authkit-nextjs 4.6.4 | Dashboard quickstart home page: await withAuth() + await getSignUpUrl() | Route "/home-page": …, then Route "/": … after moving it | <Suspense> around page bodies, plus getSignUpUrl() moved to a route handler (see below) | | Supabase Auth | @supabase/ssr 0.12.7 | Our app/page.tsx calling the SSR guide's createClient() (await cookies()) + getClaims(); the guides have no page code | Route "/": … | <Suspense> | | Clerk | @clerk/nextjs 7.10.11 | Only if you drop the quickstart's <Suspense> around <Show> in the layout | Route "/": … | <Suspense> (the quickstart's own code builds) | | Better Auth | better-auth 1.7.29 | None: we wrote the dashboard with the session read in <Suspense> | none | build passed | | Stytch | @stytch/nextjs 22.4.0 | Not affected: the Consumer quickstart reads the session client-side | none (its build failed on TypeScript errors instead) | n/a |

Reproduce on Next.js 16.4.6 without any auth vendor

bash
npx -y create-next-app@latest app --ts --app --eslint --no-tailwind --no-src-dir --import-alias "@/*" --use-npm --yes --disable-gitcd app && cat next.config.ts   # cacheComponents: true, partialPrefetching: true

Replace app/page.tsx with what server-side auth helpers do internally:

tsx
import { cookies } from 'next/headers' export default async function Home() {  const session = (await cookies()).get('session')?.value  return <main>{session ? 'Signed in' : 'Signed out'}</main>}

npx next build exits 1 with the error above. The same page using (await headers()).get('authorization') fails the same way. next dev returns 200 and renders "Signed in" for a request with a session cookie. The dev terminal does print a related error (Route "/": Next.js encountered runtime data during prerendering., pointing at app/page.tsx:5:33), but nothing on the page shows it, so an agent that only checks the page finds out at deploy.

Fix 1 for Next.js 16.4 auth pages: wrap the session read in `<Suspense>`

tsx
import { Suspense } from 'react'import { cookies } from 'next/headers' async function Session() {  const session = (await cookies()).get('session')?.value  return <p>{session ? 'Signed in' : 'Signed out'}</p>} export default function Home() {  return (    <main>      <h1>Static shell</h1>      <Suspense fallback={<p>Loading session…</p>}>        <Session />      </Suspense>    </main>  )}

next build passes and / becomes ◐ (Partial Prerender): the shell is prerendered and the session part streams in. Put the boundary as close to the auth-dependent UI as you can. Clerk's quickstart gives the same advice.

Fix 2 for Next.js 16.4 auth pages: `export const instant = false`

tsx
export const instant = false

Add it to the page (the error's [block] option). next build passes, and / becomes ƒ (Dynamic). This is the one-line fix we used for Auth0's quickstart page.

What each fix costs on Next.js 16.4.6

We put a 1.5 s delay into the session read (standing in for a remote session lookup) and streamed GET / from next start 5 times per fix (same VM, local requests):

| Fix | First body byte | Page heading arrives | Response done | |---|---|---|---| | <Suspense> | 54–57 ms | 54–58 ms (with the fallback) | 1567–1578 ms | | instant = false | 1554–1576 ms | 1554–1576 ms | 1558–1584 ms |

With instant = false, every request waits for the slowest auth call before anything paints. With <Suspense> the static part goes out at once, and you write a fallback. In both cases the response was cache-control: private, no-cache, no-store, so neither one makes an auth page cacheable.

Turning `cacheComponents` off in a Next.js 16.4 app

Changing the line to cacheComponents: false is not enough. The build stops at once:

log
Error: `partialPrefetching` requires `cacheComponents` to be enabled. Please update your next.config.ts accordingly.

Remove both lines. Then the original page builds as ƒ / (rendered per request) with no other change.

Vendor-specific notes

  • WorkOS AuthKit: passing the build is not enough. The docs' home page also returns 500 at runtime with Cookies can only be modified in a Server Action or Route Handler. getSignUpUrl() sets a PKCE cookie, and the SDK README says to call it in a route handler. This also happens with cacheComponents off.
  • Kinde: the same docs call isAuthenticated() without await, so the check never fires. Use if (!(await isAuthenticated())).

Sources

  • Next.js error page: https://nextjs.org/docs/messages/blocking-prerender-dynamic
  • Evidence (build logs, the minimal app, vendor snippets, timings): repro/NOTES.md

Side-by-side numbers for all seven providers: auth for agents, Dec 2026, hands-on comparison.

Connected posts