Skip to content
This repository was archived by the owner on Sep 21, 2026. It is now read-only.
This repository was archived by the owner on Sep 21, 2026. It is now read-only.

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

Closed

Description

@Lokeninfinitypoint

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:

  1. 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
}
  1. 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 fallback

Environment

  • 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 isCloud before calling billing.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

  1. Install self-hosted Appwrite 1.8.1 with Console 7.5.7
  2. Set PUBLIC_CONSOLE_MODE=self-hosted
  3. Log into the console
  4. Navigate to Account → Organizations
  5. Open browser DevTools → Network tab
  6. See 400 error on /v1/teams with equal("platform","appwrite") query

Activity

  1. anesukafesu commented on Feb 28, 2026

    @anesukafesu

    Hi,

    I tried to reproduce the above error and I haven't found the root cause. I am just going to share what I know so far in case it's useful to anyone working on this, or if anyone wants to suggest different ideas I could try.

    When I opened the /console/account/organizations on my self-hosted appwrite instance I ran into the error mentioned above.

    screen-capture.6.webm

    But when I cloned the appwrite/console repo, I ran the site locally in dev mode I could not reproduce the bug.

    screen-capture.7.webm

    So I tried to look at the source code to see if I can find the bug. Here's how I traced the source code:

    1. The /console/account/organizations page's source code is in the file src/lib/routes/(console)/account/organizations/+page.svelte.
    2. Before rendering the page, Svelte automatically loads the pages data by calling the load function load function defined in (src/lib/routes/(console)/account/organizations/+page.ts).
    3. This load function uses the getTeamOrOrganizationList() function to get teams or organisations to display in the page.
    4. The getTeamOrOrganizationList() function is defined in src/lib/stores/organization.ts file. This functions checks if isCloud it true. If so, it gets organisations with the query parameter platform=appwrite. If not, it gets teams without the query parameter platform=appwrite.
    5. The isCloud variable is defined in the src/lib/stores/system.ts file and is based on the PUBLIC_CONSOLE_MODE env variable. In my .env file, PUBLIC_CONSOLE_MODE is set to 'self-hosted'.
    6. For the production Appwrite console, I exec'ed the Docker container it is running in and inspected the code. Since it has gone through the build process (bundling, chunking and minifying) it is difficult to make sense of but I found a file (/usr/share/nginx/html/console/_app/env.js), and this file contains the PUBLIC_CONSOLE_MODE environment variable set to 'self-hosted'.
    Image

    And if you check the page's source in Chrome dev tools, the variable is present:

    Image

    So it seems not be an issue with environment variables, nor a logical issue (because it works when I run the dev server). So I can't think of any other reason why this would not work, other than that the code in the Docker Image is outdated. But that image was last updated 2 days ago, and the last commit in the files I have mentioned are at least a few weeks old.

  2. anesukafesu commented on Feb 28, 2026

    @anesukafesu

    Update: I tried rebuilding the container with the command:

    docker build -t my-appwrite-console
      --build-arg PUBLIC_CONSOLE_MODE=self-hosted
      --build-arg PUBLIC_APPWRITE_MULTI_REGION=false
      --build-arg PUBLIC_APPWRITE_ENDPOINT=http://localhost/v1
      --build-arg PUBLIC_CONSOLE_EMAIL_VERIFICATION=false
      --build-arg PUBLIC_CONSOLE_MOCK_AI_SUGGESTION=true
      .
    

    And the new Docker image does not produce the above error. So I think to solve the above error, we need to build a new Appwrite Console Image on Docker Hub.

  3. added a commit that references this issue on Apr 11, 2026
    c3c20c3
  4. eldadfux commented on Sep 21, 2026

    @eldadfux
    Member

    Starting today this repo is archived. Please raise any issues with the new Appwrite console on the main platform repo: https://github.com/appwrite/appwrite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions