Next.js 15: Route "/x" used `cookies().get('token')`. `cookies()` should be awaited before using its value
Since Next.js 15, cookies(), headers(), params and searchParams are async — they must be awaited.
Seen on:
Next.js
Meaning
Code written for Next.js 14 accessed them synchronously. It still works temporarily but logs this warning, and will break in future versions. A codemod updates most usages.
Common causes
- Next.js upgraded to 15 with sync dynamic API usage
- params/searchParams used without await in pages/layouts
- Libraries not yet updated
⚡ Quick fix
- await cookies()/headers()
- Type params as Promise<{...}> and await them
- Run npx @next/codemod@latest next-async-request-api .
Detailed fix by platform
TypeScript
- tsx
export default async function Page({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const token = (await cookies()).get("token")?.value; }
How to diagnose
- Version — next in package.json
- Usage — Sync calls listed in the warning
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 0xC1900101 Windows upgrade error 0xC1900101 (driver error, rolled back)
- caching_sha2_password Authentication plugin 'caching_sha2_password' cannot be loaded
- Call to undefined function create_function() WordPress on PHP 8: Fatal error: Uncaught Error: Call to undefined function create_function() / each()
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026