Synchronous cookies()/headers()/draftMode()

next/sync-dynamic-apinextjs-16correctness

Why it matters

These return Promises since Next.js 15, and synchronous access was removed in 16: the property read happens on a Promise.

Fix

Await first: (await cookies()).get("name").

Credit

  • From the Next.js team

    Made cookies(), headers() and draftMode() asynchronous in Next.js 15 and removed synchronous access in 16.

References

See it