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.

Warn instead of failing discount cron on Stripe permission errors

Kiran Kdd6c726f0181
diff --git a/apps/web/app/(ee)/api/cron/discount-codes/create/route.ts b/apps/web/app/(ee)/api/cron/discount-codes/create/route.ts
index 1686474716..f8ab77128e 100644
--- a/apps/web/app/(ee)/api/cron/discount-codes/create/route.ts
+++ b/apps/web/app/(ee)/api/cron/discount-codes/create/route.ts
@@ -96,6 +96,16 @@ export const POST = withCron(async ({ rawBody }) => {
);
}
+ // Eg: This application does not have the required permissions for this endpoint on account 'acct_xxx'.
+ // Having the 'read_write' scope would allow this request to continue.
+ if (
+ error.message.includes(
+ "This application does not have the required permissions",
+ )
+ ) {
+ return logAndRespond(error.message, { logLevel: "warn" });
+ }
+
throw error;
}