Skip to content

Commit

Permalink
fix(worker): handle exceptions properly in webhooks
Browse files Browse the repository at this point in the history
Add ctx.passThroughOnException to ensure webhook handling continues.
  • Loading branch information
gentlementlegen committed Dec 2, 2024
1 parent 2e0ed03 commit f146a64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export default {
openAiClient,
});
bindHandlers(eventHandler);
// ctx.waitUntil(eventHandler.webhooks.verifyAndReceive({ id, name: eventName, payload: await request.text(), signature: signatureSha256 }));
await eventHandler.webhooks.verifyAndReceive({ id, name: eventName, payload: await request.text(), signature: signatureSha256 });
ctx.passThroughOnException();
ctx.waitUntil(eventHandler.webhooks.verifyAndReceive({ id, name: eventName, payload: await request.text(), signature: signatureSha256 }));
return new Response("ok\n", { status: 200, headers: { "content-type": "text/plain" } });
} catch (error) {
return handleUncaughtError(error);
Expand Down

0 comments on commit f146a64

Please sign in to comment.