From ea44b592ddd6a2890aa6476ef75126d15fed83b0 Mon Sep 17 00:00:00 2001 From: valknarness Date: Fri, 7 Nov 2025 16:10:30 +0100 Subject: [PATCH] fix: await params in API route handlers for Next.js 16 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Next.js 16, route handler params are now async Promises. Updated all HTTP method handlers (GET, POST, PUT, DELETE, PATCH) to properly await the params before accessing path segments. This fixes the build error: "Type 'Promise<{ path: string[] }>' is not assignable to type '{ path: string[] }'" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/api/pastel/[...path]/route.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/app/api/pastel/[...path]/route.ts b/app/api/pastel/[...path]/route.ts index 8380868..65eb23a 100644 --- a/app/api/pastel/[...path]/route.ts +++ b/app/api/pastel/[...path]/route.ts @@ -15,37 +15,42 @@ const PASTEL_API_URL = process.env.PASTEL_API_URL || 'http://localhost:3001'; export async function GET( request: NextRequest, - { params }: { params: { path: string[] } } + { params }: { params: Promise<{ path: string[] }> } ) { - return proxyRequest(request, params.path, 'GET'); + const { path } = await params; + return proxyRequest(request, path, 'GET'); } export async function POST( request: NextRequest, - { params }: { params: { path: string[] } } + { params }: { params: Promise<{ path: string[] }> } ) { - return proxyRequest(request, params.path, 'POST'); + const { path } = await params; + return proxyRequest(request, path, 'POST'); } export async function PUT( request: NextRequest, - { params }: { params: { path: string[] } } + { params }: { params: Promise<{ path: string[] }> } ) { - return proxyRequest(request, params.path, 'PUT'); + const { path } = await params; + return proxyRequest(request, path, 'PUT'); } export async function DELETE( request: NextRequest, - { params }: { params: { path: string[] } } + { params }: { params: Promise<{ path: string[] }> } ) { - return proxyRequest(request, params.path, 'DELETE'); + const { path } = await params; + return proxyRequest(request, path, 'DELETE'); } export async function PATCH( request: NextRequest, - { params }: { params: { path: string[] } } + { params }: { params: Promise<{ path: string[] }> } ) { - return proxyRequest(request, params.path, 'PATCH'); + const { path } = await params; + return proxyRequest(request, path, 'PATCH'); } async function proxyRequest(