Type "Promise<{ params: { id: string; }; }>" is not a valid type for the function's second argument. #79492
-
Link to the code that reproduces this issuei don't have one To Reproducehello i have been getting this error for a while and can't find a way to fix this Current vs. Expected behaviorType "Promise<{ params: { id: string; }; }>" is not a valid type for the function's second argument. Provide environment informationit is on vercel node 22xWhich area(s) are affected? (Select all that apply)Not sure Which stage(s) are affected? (Select all that apply)Vercel (Deployed) Additional contextimport { NextRequest, NextResponse } from 'next/server';
export async function GET(
request: NextRequest,
context: Promise<{ params: { id: string } }>
) {
const { params } = await context;
const id = params.id; |
Beta Was this translation helpful? Give feedback.
Answered by
icyJoseph
May 22, 2025
Replies: 1 comment 5 replies
-
|
Hi, You had the Promise wrapper at the wrong level: { params }: { params: Promise<{ slug: string }> }So you'd need to change to: export async function GET(
request: NextRequest,
context: { params: Promise<{ id: string }> }
) {
const params = await context.params;
const id = params.id;
|
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
anime-kun32
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
You had the Promise wrapper at the wrong level:
So you'd need to change to:
Something like that. I'll move this to a discussion to get confirmation that you fixed this.