Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update webhook error handling to account for status -1

Kiran Kd47ec86281ba
diff --git a/apps/web/app/api/webhooks/callback/route.ts b/apps/web/app/api/webhooks/callback/route.ts
index 82539ec509..67f1fe2df3 100644
--- a/apps/web/app/api/webhooks/callback/route.ts
+++ b/apps/web/app/api/webhooks/callback/route.ts
@@ -39,7 +39,7 @@ export const POST = async (req: Request) => {
const request = Buffer.from(sourceBody, "base64").toString("utf-8");
const response = Buffer.from(body, "base64").toString("utf-8");
- const isFailed = status >= 400;
+ const isFailed = status >= 400 || status === -1;
// Unsubscribe Zapier webhook
if (
@@ -62,7 +62,7 @@ export const POST = async (req: Request) => {
url,
event,
event_id: eventId,
- http_status: status,
+ http_status: status === -1 ? 503 : status,
webhook_id: webhookId,
request_body: request,
response_body: response,