- Symptom
- Route "/account": Next.js encountered the unstable value `crypto.randomUUID()` while prerendering.The same error for `new Date()`, `Date.now()` or `Math.random()`Setting instant = false on the route does not make the error go away
- Cause
- With cacheComponents, Next.js prerenders a static shell and treats time, randomness and random bytes as IO that would freeze into it. Auth libraries often call crypto before reading headers, so the error points at code you did not write.
- Fix
- Wrap the part that needs the value in Suspense and call await connection() before the call so it runs per request, or cache it with use cache, or move it into a Client Component.
- Apply
import { connection } from 'next/server' async function Account() { await connection() // mark request-time before auth() touches crypto const session = await auth() } // render <Account /> inside <Suspense>- Affected
- Next.js 16.x with cacheComponents: true (reproduced on 16.4.1 with Auth.js)
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders