cli icon indicating copy to clipboard operation
cli copied to clipboard

CLI on Windows (v2.26.9) ignores self-hosted env vars, always defaults to cloud login, but server is healthy

Open xzhashi opened this issue 8 months ago • 0 comments

Describe the bug

The Supabase CLI (v2.26.9 on Windows) consistently ignores environment variables (SUPABASE_PROJECT_URL, etc.) for a self-hosted instance and attempts to authenticate with the Supabase Cloud, resulting in an "Access token not provided" error or a hanging command.

However, the self-hosted server is proven to be healthy and responsive, as direct API calls using PowerShell's Invoke-RestMethod work perfectly.

To Reproduce

  1. Set up a self-hosted Supabase instance on Coolify with a custom domain.
  2. Install Supabase CLI v2.26.9 on Windows using Scoop.
  3. In PowerShell, run the following command to deploy a function: $env:SUPABASE_PROJECT_URL="https://my-coolify-url.com"; $env:SUPABASE_ANON_KEY="..."; $env:SUPABASE_SERVICE_ROLE_KEY="..."; supabase functions deploy my-func --no-verify-jwt
  4. The command hangs with a blinking cursor or eventually fails with "Access token not provided".
  5. Running the same command with --debug shows the CLI is attempting to connect to https://api.supabase.com, completely ignoring the provided SUPABASE_PROJECT_URL.

Expected behavior

The CLI should use the provided environment variables to connect to the self-hosted URL.

Additional context

  • This is not a server or network issue. Running Invoke-RestMethod -Method Get -Uri "https://my-coolify-url.com/rest/v1/" with the correct apikey header works perfectly and returns the full Swagger/OpenAPI definition. This proves the server is online, healthy, and accessible.
  • This is not a corrupt installation. The issue persists after a full uninstall (including deleting the .supabase user folder) and reinstalling via Scoop.
  • This is not a login issue. Running supabase logout before the command does not solve the problem.

The evidence strongly suggests the CLI is not correctly prioritizing environment variables over a (non-existent or cleared) cloud login state on Windows.

xzhashi avatar Jun 28 '25 08:06 xzhashi