From c0033b25c97961c0caff65bd63421d90c75a7a5a Mon Sep 17 00:00:00 2001 From: FuturMix Date: Sun, 14 Jun 2026 12:01:51 +0800 Subject: [PATCH] fix: access params via event.context in webhook DELETE handler The DELETE handler references a bare `params` variable that is not defined in scope. The withAuth middleware passes Next.js context as event.context, so route params must be accessed via `await event.context.params` (async in Next.js 15). Without this fix, deleting a webhook always crashes with ReferenceError: params is not defined. Co-Authored-By: Claude Opus 4.6 --- src/app/api/webhooks/[id]/route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/webhooks/[id]/route.js b/src/app/api/webhooks/[id]/route.js index d858952..d66a7e2 100644 --- a/src/app/api/webhooks/[id]/route.js +++ b/src/app/api/webhooks/[id]/route.js @@ -4,7 +4,7 @@ import { withAuth } from '@/lib/api/middleware/auth.js'; /** Delete a webhook by ID */ export const DELETE = withAuth(async (event) => { const { supabase, user } = event.locals; - const { id } = params; + const { id } = (await event.context?.params) || {}; const { error } = await supabase .from('webhooks')