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:
Damodar Lohani authored and GitHub committed 2026-07-16 11:47:01 +05:45
commit 6ea3484705
1 file changed
+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),