Build Error - Property 'params' is missing in type...
Answered
Polish posted this in #help-forum
PolishOP
So I've tried to migrate to Nextjs 15 & React 19 from Nextjs 14. I thought everything was working until i tried building, where I'm getting this error:
Error:
Here is the file that's saying is causing the error:
Hope someone can help, as I couldn't find that much info with that specific error.
Error:
.next/types/app/api/user/[id]/connections/route.ts:49:7
Type error: Type '{ __tag__: "GET"; __param_position__: "second"; __param_type__: Params; }' does not satisfy the constraint 'ParamCheck<RouteContext>'.
Types of property '__param_type__' are incompatible.
Property 'params' is missing in type 'Promise<{ params: { id: string; }; }>' but required in type 'RouteContext'.
47 | Diff<
48 | ParamCheck<RouteContext>,
> 49 | {
| ^
50 | __tag__: 'GET'
51 | __param_position__: 'second'
52 | __param_type__: SecondArg<MaybeField<TEntry, 'GET'>>
Static worker exited with code: 1 and signal: nullHere is the file that's saying is causing the error:
import { Connection } from "@prisma/generated/dev_datbase";
import { prisma } from "@/lib/db/prisma";
type Params = Promise<{
id: string;
}>;
export async function GET(request: Request, params: Params) {
const rParams = await params;
const connections = await prisma.connection.findMany({
where: {
userId: rParams.id,
},
});
console.log("connections", connections);
return Response.json(connections);
}Hope someone can help, as I couldn't find that much info with that specific error.
Answered by Polish
Nvm, fixed it after looking at the example in https://nextjs.org/docs/app/building-your-application/upgrading/version-15#route-handlers
1 Reply
PolishOP
Nvm, fixed it after looking at the example in https://nextjs.org/docs/app/building-your-application/upgrading/version-15#route-handlers
Answer