#updating react and react types broke params

1 messages · Page 1 of 1 (latest)

left oakBOT
#

Hi @spiral sorrel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The error you're encountering is related to a breaking change in Next.js 15 regarding how route parameters are handled in API routes.

In Next.js 15, the params object is now a Promise that needs to be awaited, and the structure of the second parameter has changed. This is documented in the Route Handlers API reference.

Here's how to fix your code:

export async function GET(
  req: NextRequest,
  { params }: { params: Promise<{ route: string }> }
) {
  const { route } = await params;
  // rest of your code
}

The key changes are:

  1. The second parameter should be destructured to get params
  2. The params object is now a Promise that needs to be awaited
  3. The type definition needs to reflect this Promise structure

This change was introduced in Next.js 15 as part of making dynamic route parameters asynchronous. Many developers have encountered this same issue when upgrading, as shown in several GitHub issues discussing this exact problem.

If you continue to have issues, make sure you're using compatible versions of all your dependencies, particularly that your TypeScript version is up to date.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: