-
Notifications
You must be signed in to change notification settings - Fork 214
Description
Bug Description
On self-hosted Appwrite 1.8.1 with Console 7.5.7, the organizations page (/console/account/organizations) returns a 400 Bad Request error:
AppwriteException: Invalid `queries` param: Invalid query: Attribute not found in schema: platform
The console sends:
GET /v1/teams?queries[0]=offset(0)&queries[1]=limit(6)&queries[2]=orderDesc("")&queries[3]=equal("platform","appwrite")
→ 400 Bad Request
The platform attribute does not exist in the self-hosted teams collection schema.
Root Cause
Two functions in BrayF0lC.js (billing utilities chunk) call billing.listOrganization() without checking isCloud:
XL()— missingPaymentMethod check
// No isCloud guard!
async function XL() {
const e = await sdk.billing.listOrganization([
Query.notEqual("billingPlan", FREE),
Query.isNull("paymentMethodId"),
Query.isNull("backupPaymentMethodId"),
Query.equal("platform", Platform.Appwrite) // ← fails on self-hosted
]);
// ...shows missingPaymentMethod banner
}JL()— newDevUpgradePro check
// No isCloud guard!
async function JL(e) {
(await sdk.billing.listOrganization([
Query.notEqual("billingPlan", FREE) // ← also fails (billingPlan doesn't exist)
]))?.total
// ...
}Most other billing functions correctly guard with isCloud, for example HL():
async function HL(e, t) {
if (!isCloud || !e) return; // ✅ Correct guard
// ...billing logic
}The ternary patterns on other pages also correctly guard:
isCloud
? await sdk.billing.listOrganization([Query.equal("platform", Platform.Appwrite)])
: await sdk.teams.list() // ✅ Correct fallbackEnvironment
- Appwrite Server: 1.8.1 (Docker:
appwrite/appwrite:1.8.1) - Appwrite Console: 7.5.7 (Docker:
appwrite/console:7.5.7) - PUBLIC_CONSOLE_MODE:
self-hosted(correctly set in env.js) - Browser: Chrome 144 (macOS)
Expected Behavior
On self-hosted installations, XL() and JL() should either:
- Check
isCloudbefore callingbilling.listOrganization(), or - Be wrapped in a try/catch that silently handles the failure
Workaround
Added 'platform' to the ALLOWED_ATTRIBUTES array in Teams.php query validator, added platform column + index to the MariaDB _console_teams table, and added the attribute to the PHP collections config.
Suggested Fix
Add isCloud guard to both functions, matching the pattern already used in HL():
async function XL() {
if (!isCloud) return; // ← Add this
// ...existing billing logic
}
async function JL(e) {
if (!isCloud) return; // ← Add this
// ...existing billing logic
}Reproduction Steps
- Install self-hosted Appwrite 1.8.1 with Console 7.5.7
- Set
PUBLIC_CONSOLE_MODE=self-hosted - Log into the console
- Navigate to Account → Organizations
- Open browser DevTools → Network tab
- See 400 error on
/v1/teamswithequal("platform","appwrite")query