From 4cb518adb6b2c9a28bb62c20a1963581aebe0109 Mon Sep 17 00:00:00 2001 From: FuturMix Date: Sun, 14 Jun 2026 12:00:23 +0800 Subject: [PATCH] fix: use event.request instead of undefined request in webhook POST handler The POST handler receives a single event object from withAuth(), but references a bare `request` variable that is not defined in this scope. This causes a ReferenceError crash whenever a user tries to create a webhook. Use event.request.json() to correctly parse the request body. Co-Authored-By: Claude Opus 4.6 --- src/app/api/webhooks/route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/webhooks/route.js b/src/app/api/webhooks/route.js index cd8fd6c..f43ae61 100644 --- a/src/app/api/webhooks/route.js +++ b/src/app/api/webhooks/route.js @@ -25,7 +25,7 @@ export const POST = withAuth(async (event) => { let body; try { - body = await request.json(); + body = await event.request.json(); } catch { return NextResponse.json({ error: 'Invalid JSON' }, { status: 400 }); }