Next.js17 min read

Next.js params should be awaited: What 15 Warns About and 16 Breaks

In the App Router, params and searchParams are Promises. Next.js 15 still returns the value when the await is missing and prints a message. In a test on Next.js 16.3.5 the same code returned undefined, with no error in production. This guide covers each symptom, the fix, and what the TypeScript check does and does not catch.

Ali RehmanAli RehmanFreelance Web Developer
Published
Editorial illustration of an asynchronous route params Promise passing through an await step before being read
On this page 16 sections

You upgraded Next.js, or copied a dynamic route from an older tutorial, and the terminal now prints a line about params. Or nothing is printed, and the page shows undefined where the product name should be. Both come from one change: in the App Router, params is a Promise.

The short answer: params and searchParams are Promises, and cookies(), headers() and draftMode() return Promises. In a page, layout, generateMetadata function or route handler, make the function async and write const { slug } = await params. In a Client Component, call use(params) or the useParams() hook. Next.js 15 still returns the value when the await is missing and prints a message in development. In the test for this guide, Next.js 16 returned undefined and the production server printed nothing.

Every result below comes from one small App Router project that was run on three releases on 24 November 2026: Next.js 16.3.5, 15.5.29 and 15.1.12, with 58 recorded checks. How it was run, and what it leaves out, is described in the last section. The Pages Router is not covered.

Find your symptom first

The same mistake looks different on each version, and different again in the TypeScript check. Match what you see to a section.

What you see
→ section

"params should be awaited"
in the dev terminal (Next.js 15)
  → 1

"params is a Promise and must be
unwrapped" in the dev terminal (16)
  → 2

No error, but a value from the URL
is undefined
  → 2

Wrong title, wrong layout or a 404
on a page that exists
  → 3

An API route gets no id
  → 4

Search or filters ignore the URL
  → 5

"A param property was accessed
directly with params"
  → 6

cookies().get is not a function
  → 7

does not satisfy the constraint
'PageProps'
  → 8

The build passes, the page is wrong
  → 9

Tested on Next.js 16.3.5, 15.5.29
and 15.1.12.

If you do not know which version the project runs, look at next in package.json, or at the first line that next dev prints. In the test that line read “▲ Next.js 16.3.5 (Turbopack)” on one project and “▲ Next.js 15.5.29” on the other.

What changed between Next.js 14, 15 and 16

In Next.js 14 and earlier, params was a plain object, and a page could read params.slug on its first line. Next.js 15 changed that. Its upgrade guide lists what became asynchronous: cookies, headers, draftMode, params in layout, page, route, default, opengraph-image, twitter-image, icon and apple-icon files, and searchParams in pages. The same guide says these APIs “can temporarily be accessed synchronously”.

That temporary period ended with the next major version. The Next.js 16 upgrade guide states: “Starting with Next.js 16, synchronous access is fully removed.” The page file reference describes params as a promise and says you must use async/await or React’s use function to access the values.

So there are three situations, and the version alone decides which one you are in:

  • Next.js 14 and earlier. params.slug is correct and this guide does not apply. That version was not part of the test.
  • Next.js 15. params.slug still returns the value, and development prints a message.
  • Next.js 16. params.slug is undefined.
Diagram contrasting a direct synchronous property read that triggers a warning with an awaited read that resolves cleanly
Illustration: in Next.js 15 and 16, route params arrive as a Promise and must be awaited before reading their properties.

1. Next.js 15: the page works and the terminal complains

On Next.js 15.5.29 this page rendered the correct value, in development and in production:

// app/sync/[slug]/page.tsx
// The old way. Do not copy it.
export default function Page(
  { params }: { params: any }
) {
  return <p>slug={String(params.slug)}</p>;
}

The development terminal printed one line for each request. It is wrapped here to fit:

Error: Route "/sync/[slug]" used
`params.slug`. `params` should be awaited
before using its properties. Learn more:
https://nextjs.org/docs/messages/sync-dynamic-apis

The line begins with the word Error, yet the request answered 200 with the right content. The production server, started with next start, printed nothing for the same page. That is why this problem goes unnoticed on Next.js 15: nothing is broken yet.

The wording follows the way the value was read. All of these were recorded on 15.5.29:

  • searchParams.q in a page: “searchParams should be awaited before using its properties.”
  • { ...params }: the route “used ...params or similar expression”.
  • cookies().get('theme'): “cookies() should be awaited before using its value.” The messages for headers() and draftMode() use the same sentence.

The message also appeared for a read inside generateMetadata, inside a layout and inside a route handler. Each one links to the message page in the Next.js documentation. For a Server Component the browser showed nothing about it: no console line and no entry in the error overlay. If you only watch the browser, you will not see it.

Treat the message as a deadline. The code that prints it on 15 returned undefined on 16.

2. Next.js 16: no error, the value is just undefined

The same page on Next.js 16.3.5 answered with status 200 and this text: slug=undefined. No exception was thrown. In development the terminal printed a different sentence from the one on 15:

Error: Route "/sync/[slug]" used
`params.slug`. `params` is a Promise and
must be unwrapped with `await` or
`React.use()` before accessing its
properties. Learn more:
https://nextjs.org/docs/messages/sync-dynamic-apis

In production the server printed nothing at all. The page rendered, the status was 200 and the value was missing. A Promise is an object, and in JavaScript reading a property that an object does not have gives undefined; it does not throw.

What that does to a real page depends on where the value goes. Each of these was recorded in production on 16.3.5:

  • The page title. A generateMetadata function that built the title from params.slug produced “Post undefined”, while the page body, which awaited params, was correct.
  • A not-found check. A page that calls notFound() when params.slug is empty answered 404 for a valid URL. On 15.5.29 the same URL answered 200.
  • A layout. The layout received undefined while the page inside it showed the right value.
  • A route handler. context.params.id was undefined, and the handler still answered 200.
  • A copy of the object. { ...params } produced an object with no keys.

None of these stops the build or shows an error page. A title of “Post undefined” on every product, or a 404 on every article, tends to be found by a visitor or in a search report, not by a test run. If the value is passed on to a database query or a fetch call, that call runs with undefined; what happens next depends on your code and was not part of this test.

An undefined value has other causes as well. If it comes from process.env and not from the URL, the guide on Next.js environment variables not working is the one to read.

3. The fix for pages, layouts and generateMetadata

Make the function async, type params as a Promise, and await it before reading from it. A page written this way returned the right value on both versions, in development and in production, with no message:

// app/shop/[slug]/page.tsx
type Props = {
  params: Promise<{ slug: string }>;
};

export default async function Page(
  { params }: Props
) {
  const { slug } = await params;
  return <h1>{slug}</h1>;
}

Await the whole object, then take the property. Writing await params.slug is not the same thing: JavaScript reads slug from the Promise first and awaits the result, which is the mistake you are trying to remove.

generateMetadata receives the same Promise and needs its own await. Fixing the page does not fix the title, as the “Post undefined” result shows. The generateMetadata reference types both params and searchParams as Promises.

export async function generateMetadata(
  { params }: Props
) {
  const { slug } = await params;
  return { title: `Post ${slug}` };
}

Layouts follow the same rule. Their params prop is a Promise too:

// app/shop/[slug]/layout.tsx
export default async function Layout({
  children,
  params,
}: {
  children: React.ReactNode;
  params: Promise<{ slug: string }>;
}) {
  const { slug } = await params;
  return (
    <section data-slug={slug}>
      {children}
    </section>
  );
}

Pages that are prerendered with generateStaticParams need nothing more. In the test a page that exported that function and awaited params was still prerendered at build time on both versions.

4. Route handlers: await context.params

A route handler gets its params through the second argument. The route file reference notes that context.params is now a promise. On 16.3.5 the old pattern answered 200 with an undefined id, which is easy to miss because the status looks healthy.

// app/api/items/[id]/route.ts
export async function GET(
  _request: Request,
  { params }: {
    params: Promise<{ id: string }>;
  }
) {
  const { id } = await params;
  return Response.json({ id });
}

With that change the handler returned the id as a string on both versions. If the handler loads a record by id, call it with a real id after the change and read the body of the response, not only the status.

5. searchParams, and a page that stops reading the query string

searchParams changed in the same way, and its failure has a second part. The test page read searchParams.q without await and was requested as /sync-search?q=boots. On 15.5.29 it showed q=boots. On 16.3.5 it showed q=undefined.

The build output shows the second part. The page file reference says that using searchParams opts the page into dynamic rendering at request time. On 16.3.5 the page that never awaited it was listed as static in the build output: it was prerendered once, at build time, when there is no query string. The page that awaited searchParams was listed as dynamic. On 15.5.29 both were dynamic.

So on 16 the old code breaks a search, filter or pagination page twice. The value is missing, and the page is no longer rendered for each request. The fix is the same one line:

// app/search/page.tsx
export default async function Page({
  searchParams,
}: {
  searchParams: Promise<{ q?: string }>;
}) {
  const { q } = await searchParams;
  return <p>Results for {q ?? "all"}</p>;
}

After the change, read the route list that next build prints. A page that depends on the query string should carry the symbol for dynamic rendering, not the one for static.

6. Client Components: use() or useParams()

A page file that starts with "use client" also receives params as a Promise. A Client Component cannot be an async function, so await is not available there. Two other ways to read the value worked on both versions:

  • use(params) in the page component itself. React’s use function reads the value of a Promise during render.
  • useParams() in any Client Component below the page. The useParams reference describes it as a hook that reads the route’s dynamic params filled in by the current URL, so nothing has to be passed down as a prop.
"use client";
import { use } from "react";

export default function Page(
  { params }: {
    params: Promise<{ slug: string }>;
  }
) {
  const { slug } = use(params);
  return <h1>{slug}</h1>;
}

Reading params.slug directly in a Client Component split along the same line as everything else. On 15.5.29 the value appeared, and in development the browser console printed “A param property was accessed directly with params.slug. params is now a Promise and should be unwrapped with React.use()”, followed by a note that direct access is still supported to facilitate migration. On 16.3.5 the page showed slug=undefined. In development the console said that params “is a Promise and must be unwrapped with React.use() before accessing its properties”, and the error overlay reported an issue. In production the console was empty and the value was still undefined.

searchParams works the same way in a client page: use(searchParams) returned the query value on both versions.

One wrong turn is common here: adding async to the Client Component so that await params compiles. In development both versions printed that the page “is an async Client Component. Only Server Components can be async at the moment”, and then “A component was suspended by an uncached promise.” The Next.js page for that message says that React Client Components do not support async functions. The value did reach the screen in the test, but that is no reason to keep the code, and a production build of that page was not tested.

Client Components have a second surprise that is unrelated to params: for a fresh page load, their first render happens on the server too. That is the subject of Next.js window is not defined.

Diagram showing an async Server Component awaiting params and passing plain values to a Client Component
Illustration: await params in an async Server Component, or unwrap them with React's use() hook in a Client Component.

7. cookies(), headers() and draftMode()

These three functions changed at the same time, and two of them fail more loudly than params. The cookies reference calls cookies an asynchronous function that returns a promise, and the draftMode reference describes draftMode as an async function.

On 15.5.29, cookies().get("theme") without await returned the cookie, and the development terminal printed that cookies() should be awaited before using its value. On 16.3.5 the same line answered 500. In development the terminal showed the explanation and then the failure:

Error: Route "/cookies-sync" used
`cookies().get`. `cookies()` returns a
Promise and must be unwrapped with
`await` or `React.use()` before accessing
its properties.

⨯ TypeError: store.get is not a function

In production only the second line was printed, and with a shortened name: ⨯ TypeError: a.get is not a function. A production build renames variables, so the letter in front of .get will differ in your project. If “get is not a function” appears after an upgrade, look for cookies() or headers() without await. headers().get() failed in the same way.

draftMode() is the quiet one. Without await, draftMode().isEnabled was undefined on 16.3.5 and the status was 200. A check such as if (draftMode().isEnabled) therefore behaves as if draft mode is always off, and a preview feature stops working without any error. Switching draft mode on and then reading it was not part of the test.

import { cookies, headers, draftMode }
  from "next/headers";

// Inside an async function:
const theme =
  (await cookies()).get("theme")?.value;
const agent =
  (await headers()).get("user-agent");
const { isEnabled } = await draftMode();

The awaited cookies() call returned the cookie on both versions. The other two were tested only in their failing form. Cookies that are read from the request object in proxy.ts or middleware are a separate topic, covered in Next.js middleware not working.

8. The TypeScript error about PageProps

On Next.js 15 many people meet this change as a failed build, not as a terminal message. A page typed the old way, with params: { slug: string }, stopped next build on both 15.1.12 and 15.5.29:

.next/types/app/t/old-page/[slug]/page.ts:34:29
Type error: Type
'{ params: { slug: string; }; }' does not
satisfy the constraint 'PageProps'.
  Types of property 'params' are
  incompatible.
    Type '{ slug: string; }' is missing
    the following properties from type
    'Promise<any>': then, catch, finally,
    [Symbol.toStringTag]

Three details make this error hard to read. The file it names sits under .next/types, which Next.js generates during the build, so opening it does not help; the file to fix is the page whose path follows .next/types/app. The name PageProps is Next.js’s own type, not one of yours. And the last sentence is the useful one: your type says params is an object, while Next.js expects something with then, catch and finally, which is a Promise.

On 15.1.12 the same check also rejected the old types for generateMetadata, for a layout (“does not satisfy the constraint 'LayoutProps'”), for a route handler and for searchParams. The fix is to change the type and add the await, as in sections 3 to 5. Changing only the type until the error disappears, without awaiting, leaves the runtime problem where it was.

9. Why the Next.js 16 build can pass with the old types

This is the result that matters most for an upgrade. The page that failed the build on both Next.js 15 releases built without any error on 16.3.5. It was typed as a plain object, it read params.slug without await, the build passed, and at runtime the value was undefined.

The generated type file shows why. On 16.3.5 Next.js writes one file, .next/types/validator.ts, and in it the props of a page are typed as the Promise type combined with any. A type combined with any accepts everything, so the old page type passes. The compiler reported no error for the old page type, the old generateMetadata type or the old searchParams type. The same file with the same line is generated on 15.5.29, where next typegen followed by tsc did not report the old page type either; only the full build on that version did.

Layouts and route handlers are checked more strictly. On 16.3.5 the old layout type and the old route handler type each stopped the build. The layout’s output, shortened:

.next/types/validator.ts(283,31): error
TS2344: Type 'typeof import("…/layout")'
does not satisfy the constraint
'LayoutConfig<"/t/old-layout/[slug]">'.
…
Property 'slug' is missing in type
'Promise<{ slug: string; }>' but required
in type '{ slug: string; }'.
Failed to type check.
What this means: on Next.js 16 a clean build and a 200 status do not prove that every page awaits its params. In this test the build caught layouts and route handlers and missed pages.

There is a way to get the check back for pages. Next.js generates helper types named PageProps, LayoutProps and RouteContext. The page, layout and route references each describe theirs as a globally available helper, so there is nothing to import. The helper takes the route as a string:

// app/shop/[slug]/page.tsx
export default async function Page(
  props: PageProps<"/shop/[slug]">
) {
  const { slug } = await props.params;
  return <h1>{slug}</h1>;
}

When the test page used the helper and read the value without await, the compiler reported the error in the page’s own file, at the exact line, on 16.3.5 and on 15.5.29:

app/t/helper-sync/[slug]/page.tsx(2,27):
error TS2339: Property 'slug' does not
exist on type 'Promise<{ slug: string; }>'.

A route handler typed with RouteContext was caught in the same way. The helper types come from generated files. The page reference says they are generated during next dev, next build or with next typegen, and the CLI reference describes next typegen as generating the route types without a full build. The version 16 upgrade guide adds that the command was introduced in Next.js 15.5. In the test it finished on 16.3.5 and 15.5.29 and wrote validator.ts and routes.d.ts.

The codemod and what it leaves behind

Next.js ships a codemod for this migration. The codemods page gives the command:

# Run from the project root, on a clean
# Git branch so the diff is easy to review
npx @next/codemod@latest \
  next-async-request-api .

According to that page, when automatic migration is not possible the codemod adds an @next-codemod-error comment and may add a temporary UnsafeUnwrapped cast, and the migration has to be completed before those are removed. The message page says it in fewer words: the codemod cannot cover all cases, so some code may need manual changes.

I did not run the codemod in this test, so I cannot say which patterns it handles. Whatever it changes, search the project afterwards for @next-codemod-error and UnsafeUnwrapped, and treat every hit as unfinished work. A cast changes what the compiler believes, not what the function returns, and in this test the old-style reads that were typed as any were the ones that returned undefined or failed on 16.3.5.

How to check an upgrade from 15 to 16

Production on 16 is silent, so the checking has to happen before the upgrade or in development. This order follows what the test showed about where each problem is visible:

  1. 1While still on 15, run next dev and open every kind of route once. Watch the terminal, not the browser, for “should be awaited”. Each line names the route and the expression.
  2. 2Search the code. Look for params., searchParams., cookies()., headers(). and draftMode().. Include generateMetadata, layouts and route handlers, not only pages.
  3. 3Fix them on 15. Awaited code worked on both versions in the test, so the fix can ship before the upgrade.
  4. 4Use the generated helper types for pages, layouts and route handlers where you want the compiler to report a missing await. Then run next typegen and tsc --noEmit.
  5. 5After upgrading, run next dev again and look for “is a Promise and must be unwrapped” in the terminal.
  6. 6Read the build’s route list. Pages that depend on the query string should be dynamic.
  7. 7Request real URLs on the production build and read what comes back: the title, a value from the URL, a search result and an API response.
# Types without a full build (15.5 or later)
npx next typegen
npx tsc --noEmit

# The title of a page on the production build
curl -s https://example.com/shop/shoes \
  | grep -o "<title>[^<]*</title>"
# Expect the real name, not "undefined"

When to bring in a developer

A handful of pages is an afternoon of mechanical edits. It becomes a project when the app has many dynamic routes and no tests, when params travel through several layers of components and helpers, when a library or generated code still reads them the old way, or when the upgrade to 16 has already shipped and you need to learn which pages are serving undefined. That last case needs a crawl of the live site and a look at titles, status codes and API responses, not only a code search.

Useful things to send: the Next.js version before and after, the terminal output of next dev, the route list from next build, and two or three URLs that look wrong. I take on upgrades like this through my Next.js development service; write to me from the contact page with those details. And if you would rather vet someone else for it, how to hire a Next.js developer has a question list that fits this job too.

Frequently asked questions

Why is params undefined in Next.js 16?

Because params is a Promise and the code reads a property from the Promise itself. Next.js 15 still returned the value in that case. In the test, Next.js 16.3.5 returned undefined with status 200. Add await in server code, or use(params) in a Client Component.

Why is the message in the terminal and not in the browser?

For a Server Component the read happens on the server, so the message goes to the terminal that runs next dev. In the test the browser console and the error overlay showed nothing about it on either version. Only a Client Component that read params directly produced a console message.

Do I have to make every page async?

Only the ones that read params, searchParams, cookies(), headers() or draftMode(). A page that reads none of them can stay as it is. A Client Component stays synchronous and uses use() or useParams().

Can I use await params in a Client Component?

No. A Client Component cannot be an async function, and both versions printed an error about an async Client Component in development. Use use(params) in the page, or useParams() in a component below it.

Does awaiting params stop a page from being prerendered?

It did not in the test. A page with generateStaticParams that awaited params was prerendered on both versions. searchParams is different: the documentation says that using it makes the page render at request time.

Why did the build pass when the page was still wrong?

On 16.3.5 the generated type check accepted a page typed the old way, so the build passed and the value was undefined at runtime. Layouts and route handlers were caught. Type the page with the PageProps helper if you want the compiler to report a missing await.

Sources, test and review scope

Rules that this guide attributes to documentation come from the pages linked in the text, each read on 24 November 2026: the Next.js upgrade guides for versions 15 and 16; the file references for page, layout and route; the function references for generateMetadata, generateStaticParams, useParams, cookies and draftMode; the codemods page and the CLI reference; the two Next.js message pages; and React’s reference for use. Any message shown in quotation marks or in a code block was copied out of what the test printed; long lines are wrapped.

The test used one small App Router project written in TypeScript. It was installed three times from the npm registry, each time in its own folder: with Next.js 16.3.5, 15.5.29 and 15.1.12, all with React 19.2.4 and TypeScript 5.9.3, on Node.js 24.12. The main project was built and run on 16.3.5 with Turbopack and on 15.5.29 with webpack, in production with next start and in development with next dev. Each page was requested without a browser, to see what the server sends and what its terminal prints, and then opened in Microsoft Edge to see the hydrated result and the console. The type cases were checked on all three releases. The project was built 8 times in total, and the run recorded 14 steps and 58 expectations, all of which matched. The main ones:

  1. 1On 15.5.29 every old-style read returned the real value in development and in production. Development printed “should be awaited” and production printed nothing.
  2. 2On 16.3.5 the same reads returned undefined, a wrong title, a 404 or an empty object, and production printed no message for them.
  3. 3cookies().get() and headers().get() without await answered 500 on 16.3.5, and draftMode().isEnabled was undefined.
  4. 4A page that read searchParams without await was prerendered as static on 16.3.5 and was dynamic on 15.5.29.
  5. 5Awaited reads, use(params), use(searchParams) and useParams() returned the right values on both versions with no message.
  6. 6A page typed the old way failed the build on 15.1.12 and 15.5.29 and passed it on 16.3.5. Old layout and route handler types failed the build on 16.3.5.
  7. 7With the generated helper types, a missing await was a compiler error in the page’s own file on 16.3.5 and 15.5.29.

Limits: everything ran on one Windows computer with the Node.js server that ships with Next.js. Outside the test: Vercel and other hosts, Docker containers, the Edge runtime, the Pages Router, Next.js 14, any other 15 or 16 release, opengraph-image and icon files, parallel-route default files, the codemod, and what a database or an API does when it receives undefined. A release that was not installed here can behave differently. The pages in the project were small synthetic examples. I used AI tools for the research and to run the test, and I read every recorded result against the documentation linked above before this went live.

Written by

Ali Rehman - Freelance Web Developer

I work on WordPress websites, practical fixes and scoped web applications. Read my background and skill scope, or send a project brief to discuss a written plan and quote - start here.

More articles by Ali Rehman →