From 2f2e82bc9fa2a074c0aa5f89a93b649ab55d857d Mon Sep 17 00:00:00 2001 From: Jan Vennemann Date: Tue, 8 Apr 2025 21:24:00 +0200 Subject: [PATCH 1/2] fix: return 200 response for unused handlers --- index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 3cc9f44..71d0a59 100644 --- a/index.ts +++ b/index.ts @@ -165,8 +165,9 @@ export async function handleWebhooks(config: WebhookRegistrationConfig, req: Req return await _handler(evt, handlerMap[evt.type] as HandlerFn) } - // If we don't have a handler for the event, return a 404 - return new Response('', { status: 404 }) + // If we don't have a handler for the event, still return 200 response or else + // the Clerk webhook overview shows high error rate + return new Response('', { status: 200 }) } async function _handler(event: WebhookEvent, callback: Function): Promise { @@ -176,4 +177,4 @@ async function _handler(event: WebhookEvent, callback: Function): Promise Date: Tue, 8 Apr 2025 21:30:25 +0200 Subject: [PATCH 2/2] chore: adjust comment --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 71d0a59..f134d25 100644 --- a/index.ts +++ b/index.ts @@ -166,7 +166,7 @@ export async function handleWebhooks(config: WebhookRegistrationConfig, req: Req } // If we don't have a handler for the event, still return 200 response or else - // the Clerk webhook overview shows high error rate + // the Clerk will keep retrying the event return new Response('', { status: 200 }) }