Skip to content

fix(billing): skip cloud-only organization queries on self-hosted#2973

Open
singhvishalkr wants to merge 1 commit intoappwrite:mainfrom
singhvishalkr:fix/2835-billing-iscloud-guards
Open

fix(billing): skip cloud-only organization queries on self-hosted#2973
singhvishalkr wants to merge 1 commit intoappwrite:mainfrom
singhvishalkr:fix/2835-billing-iscloud-guards

Conversation

@singhvishalkr
Copy link
Copy Markdown

@singhvishalkr singhvishalkr commented Apr 11, 2026

Problem

On self-hosted Appwrite instances, the billing store calls organizations.list with cloud-only query filters (Query.equal('platform', Platform.Appwrite) and Query.notEqual('billingPlan', ...)). These queries return 400 errors because the self-hosted API does not support billing-related fields.

Solution

Added early if (!isCloud) return guards at the start of checkForMissingPaymentMethod and checkForNewDevUpgradePro in src/lib/stores/billing.ts. The isCloud flag was already imported from $lib/system.

How to test

  1. Run Appwrite in self-hosted mode
  2. Navigate to the Console
  3. Verify no 400 errors from /v1/teams in the network tab

Fixes #2835

checkForMissingPaymentMethod and checkForNewDevUpgradePro call
organizations.list with cloud-only filters. Short-circuit on
self-hosted so callers cannot trigger 400s for missing attributes.

Fixes appwrite#2835
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 11, 2026

Greptile Summary

Adds if (!isCloud) return; guards at the top of checkForMissingPaymentMethod and checkForNewDevUpgradePro in src/lib/stores/billing.ts. This prevents those functions from issuing organizations.list queries with cloud-only filters (platform, billingPlan) against self-hosted instances that don't support those fields. The fix correctly follows the established pattern already used elsewhere in the file (e.g., getStorageCapacity at line 230) and isCloud was already imported.

Confidence Score: 5/5

Safe to merge — minimal, targeted fix with no functional risk.

Both guards follow the established pattern (if (!isCloud) return;) already present in the file, isCloud is already imported, and no logic is altered for cloud deployments. No P0/P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
src/lib/stores/billing.ts Adds two if (!isCloud) return; early-exit guards consistent with the existing pattern in this file; prevents invalid cloud-only queries on self-hosted.

Reviews (1): Last reviewed commit: "Guard billing organization queries when ..." | Re-trigger Greptile

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.

Self-hosted: 400 error on /v1/teams — unguarded billing.listOrganization() calls query non-existent 'platform' attribute

1 participant