#updating react and react types broke params
1 messages · Page 1 of 1 (latest)
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:
- The second parameter should be destructured to get
params - The
paramsobject is now a Promise that needs to be awaited - 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.