Vercel build logs or terminal

DynamicServerError: Dynamic server usage: Route /… couldn't be rendered statically because it used `cookies` or `headers`.

What it means
Next.js tried to pre-build a page as fixed HTML at build time, but the page reads the current visitor's session cookies or request headers.
Likely causes
  • A page that checks the Better Auth session was marked as force-static or called inside a static route.
  • Reading cookies() or headers() inside a route or helper that Next.js expected to prerender at build time.
Prevention
Wrap personalized or session-dependent sections in <Suspense> or let authenticated pages render dynamically.

Copy for your agent

The build shows `DynamicServerError: Dynamic server usage`. Check why that route is being statically prerendered while reading cookies/headers and configure the route or Suspense boundary properly.

Full help articleThe Vercel build failed

Last reviewed Nov 8, 2026