Skip to content

Commit 0a24bb4

Browse files
authored
Merge pull request #3990 from dubinc/fix-discount-code
Skip instead of failing discount cron on Stripe permission errors
2 parents 1392b11 + 26f4413 commit 0a24bb4

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • apps/web/app/(ee)/api/cron/discount-codes/create

apps/web/app/(ee)/api/cron/discount-codes/create/route.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ export const POST = withCron(async ({ rawBody }) => {
9696
);
9797
}
9898

99+
// Eg: This application does not have the required permissions for this endpoint on account 'acct_xxx'.
100+
// Having the 'read_write' scope would allow this request to continue.
101+
if (
102+
error instanceof Error &&
103+
error.message.includes(
104+
"This application does not have the required permissions",
105+
)
106+
) {
107+
return logAndRespond(error.message, { logLevel: "warn" });
108+
}
109+
99110
throw error;
100111
}
101112

0 commit comments

Comments
 (0)