Skip to content

fix: handle webhook-race on Premium Geo DB addon enable#3123

Merged
lohanidamodar merged 1 commit into
mainfrom
fix/premium-geo-db-invoice-race
Jul 16, 2026
Merged

fix: handle webhook-race on Premium Geo DB addon enable#3123
lohanidamodar merged 1 commit into
mainfrom
fix/premium-geo-db-invoice-race

Conversation

@lohanidamodar

Copy link
Copy Markdown
Member

When enabling the Premium Geo DB addon, the Stripe webhook can activate the addon and mark its invoice succeeded just before the console's explicit confirmAddonPayment call. The backend then can't find a pending invoice and returns billing_invoice_not_found (HTTP 404) — even though the addon is already enabled and charged.

The enable modal's catch only special-cased 409, so this benign race surfaced a confusing "Invoice no longer exists" error to the user despite success.

This tolerates the race 404 (billing_invoice_not_found / addon_not_found) on the inline confirm — re-syncing state and reporting success — mirroring the existing handling in premiumGeoDB.svelte's confirmAddon.

@appwrite

appwrite Bot commented Jul 16, 2026

Copy link
Copy Markdown

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Processing Processing View Logs Preview URL QR Code

Tip

GraphQL API works alongside REST and WebSocket protocols

@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a confusing UX bug where the Premium Geo DB enable modal would surface an "Invoice no longer exists" error when the Stripe webhook activated the addon just before the console's explicit confirmAddonPayment call. The fix is a focused error-handling change.

  • Wraps the confirmAddonPayment call in a try/catch that swallows 404 errors with types billing_invoice_not_found or addon_not_found, treating them as a successful race rather than a failure.
  • State invalidation and the success notification still fire after a swallowed 404, keeping the UI consistent with the actual backend state.
  • The pattern precisely mirrors the existing guard already present in premiumGeoDB.svelte's confirmAddon function, maintaining consistency across both enable paths.

Confidence Score: 5/5

Safe to merge — the change is a narrow error-handling addition with no impact on the happy path.

The change wraps a single API call in a try/catch and swallows only the two specific error types the PR targets, matching the identical guard already in use elsewhere in the same settings directory. State invalidation and the success notification still run after a caught error, so the UI stays consistent with actual backend state. No new code paths are introduced and the existing 409 handling is untouched.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDBEnableModal.svelte Wraps confirmAddonPayment in a try/catch that swallows 404 errors with types billing_invoice_not_found or addon_not_found, mirroring the pattern already used in premiumGeoDB.svelte to tolerate the Stripe webhook race condition.

Reviews (1): Last reviewed commit: "fix(premiumGeoDB): treat webhook-race 40..." | Re-trigger Greptile

@lohanidamodar
lohanidamodar merged commit 6ea3484 into main Jul 16, 2026
3 of 4 checks passed
@lohanidamodar
lohanidamodar deleted the fix/premium-geo-db-invoice-race branch July 16, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant