Synchronous cookies()/headers()/draftMode()
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
- cookiesNext.js
- headersNext.js
- draftModeNext.js
- How to upgrade to version 16Next.js