Back to listCategory compatibility Workaround partial Stage debug Freshness persistent Scope framework Recurring Yes
Unexpected Cookie Behavior in Next.js Server Components
5/10 MediumThe cookies() API allows type-checked usage like cookies().set() anywhere, but fails at runtime in certain contexts. This unexpected behavior differs from traditional request object access and creates developer footguns.
Collection History
Query: “What are the most common pain points with Next.js in 2025?”3/27/2026
One common footgun is in how cookies are handled. You can call `cookies().set("key", "value")` anywhere and it will type-check, but in some cases it will fail at runtime.
Created: 3/27/2026Updated: 3/27/2026