Next.js Dynamic Server Usage: The Static-Dynamic Boundary

Your build fails because a page tried to read a header. Here is what triggers dynamic rendering and how to decide what each route should be.

Next.js Dynamic Server Usage: Understanding the Static and Dynamic Boundary. Abstract next.js illustration in orange and dark grey on debugly.dev
API Why it forces dynamic
cookies() Cookies are per request
headers() Headers are per request
searchParams prop Query string is per request
draftMode() Reads a cookie
fetch(..., { cache: "no-store" }) Explicitly opts out of caching
unstable_noStore() Same, explicitly
export const dynamic = "force-dynamic" Explicit
export const revalidate = 0 Same effect

Published on debugly.dev by Rohit Bhadani | Founder of Krova Cloud