cookies() should be awaited ▲ Next.js

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

  1. await cookies()/headers()
  2. Type params as Promise<{...}> and await them
  3. Run npx @next/codemod@latest next-async-request-api .

Detailed fix by platform

TypeScript

  1. 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

  1. Version — next in package.json
  2. 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:

🧠 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.