mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #3123 from appwrite/fix/premium-geo-db-invoice-race
fix: handle webhook-race on Premium Geo DB addon enable
This commit is contained in:
1 file changed
+17
-4
+17
-4
@@ -60,10 +60,23 @@
|
||||
return;
|
||||
}
|
||||
|
||||
await sdk.forConsoleIn(page.params.region).projects.confirmAddonPayment({
|
||||
projectId: page.params.project,
|
||||
addonId: paymentAuth.addonId
|
||||
});
|
||||
try {
|
||||
await sdk.forConsoleIn(page.params.region).projects.confirmAddonPayment({
|
||||
projectId: page.params.project,
|
||||
addonId: paymentAuth.addonId
|
||||
});
|
||||
} catch (e) {
|
||||
// A 404 here means the Stripe webhook already consumed the invoice
|
||||
// and activated the addon (race) — the addon is enabled, so sync
|
||||
// state and assume success rather than surfacing the error.
|
||||
if (
|
||||
e?.type !== 'billing_invoice_not_found' &&
|
||||
e?.type !== 'addon_not_found' &&
|
||||
e?.code !== 404
|
||||
) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
invalidate(Dependencies.ADDONS),
|
||||
|
||||
Reference in new issue
Block a user