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.

Return 500 when the renewal cron cannot start the workflow

Rafi42fbe3ae8bec
diff --git a/apps/web/app/(ee)/api/cron/domains/renewal-succeeded/route.ts b/apps/web/app/(ee)/api/cron/domains/renewal-succeeded/route.ts
index 6370e30310..85e4e38e2b 100644
--- a/apps/web/app/(ee)/api/cron/domains/renewal-succeeded/route.ts
+++ b/apps/web/app/(ee)/api/cron/domains/renewal-succeeded/route.ts
@@ -25,7 +25,20 @@ export const POST = withCron(async ({ rawBody }) => {
},
});
+ const [result] = results;
+
+ // Return a 500 so that QStash redelivers the message, since the outbox write for a failed dispatch can also fail
+ if (result?.status !== "published") {
+ return logAndRespond(
+ `Failed to trigger renew domains workflow for invoice ${invoiceId}: ${result?.lastError}`,
+ {
+ status: 500,
+ logLevel: "error",
+ },
+ );
+ }
+
return logAndRespond(
- `Renew domains workflow ${results[0]?.status} for invoice ${invoiceId}.`,
+ `Renew domains workflow published for invoice ${invoiceId}.`,
);
});