Skip to content

supabase status -o json drops API_URL when postgrest is in -x, even though Kong still serves /auth/v1 and /storage/v1 #5332

@ddevdiv

Description

@ddevdiv

Reproduction

supabase start -x postgrest
supabase status -o json

Expected

API_URL, REST_URL, and GRAPHQL_URL are still present in the JSON output. The user excluded only the PostgREST container; Kong is still running and ${API_URL}/auth/v1/* and ${API_URL}/storage/v1/* are still reachable.

Actual (v2.101.0)

All three keys are absent from the JSON output:

{
  "DB_URL": "postgresql://...",
  "PUBLISHABLE_KEY": "sb_publishable_...",
  "SERVICE_ROLE_KEY": "..."
}

Root cause

In apps/cli-go/internal/status/status.go, toValues computes:

apiEnabled := utils.Config.Api.Enabled &&
    !slices.Contains(exclude, utils.RestId) &&
    !slices.Contains(exclude, utils.ShortContainerImageName(utils.Config.Api.Image))

Config.Api.Image is the PostgREST image, so the short name resolves to "postgrest". When postgrest is in exclude, apiEnabled flips false and the whole API_URL / REST_URL / GRAPHQL_URL block is omitted.

But the three URLs aren't all served by PostgREST — they're served by Kong (Config.Api.KongImage). PostgREST is only the upstream for ${API_URL}/rest/v1/* specifically; /auth/v1/* (GoTrue) and /storage/v1/* (Storage) are routed through Kong regardless of whether PostgREST is up. So excluding postgrest should suppress at most REST_URL and GRAPHQL_URL, never API_URL.

Suggested fix

Split the gating so API_URL is governed by Kong's presence, not PostgREST's. Rough sketch:

kongRunning := utils.Config.Api.Enabled &&
    !slices.Contains(exclude, utils.KongId) &&
    !slices.Contains(exclude, utils.ShortContainerImageName(utils.Config.Api.KongImage))
postgrestRunning := kongRunning &&
    !slices.Contains(exclude, utils.RestId) &&
    !slices.Contains(exclude, utils.ShortContainerImageName(utils.Config.Api.Image))

if kongRunning {
    values[c.ApiURL] = utils.Config.Api.ExternalUrl
    if postgrestRunning {
        values[c.RestURL]    = utils.GetApiUrl("/rest/v1")
        values[c.GraphqlURL] = utils.GetApiUrl("/graphql/v1")
    }
}

Impact

supabase status -o json is the documented way to discover the local stack from outside the CLI (env-export pipelines, test harnesses, CI). A user excluding PostgREST for unrelated reasons silently loses the entire API surface from that output, with no warning. We hit this in CI when the supabase/setup-cli action was on version: latest and picked up 2.101.0 — same exclude list that was green on 2.100, but every integration test then failed at setup because API_URL was missing.

Workaround

Drop postgrest from -x and pay the extra container cost (~10 s, ~50 MB).

Version

  • CLI: v2.101.0
  • Repro: GitHub Actions Ubuntu runner; also reproduces on macOS with the same CLI version.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions