Skip to content

fix(cli): decode sso providers when saml id/entity_id are absent#5479

Open
Coly010 wants to merge 1 commit into
developfrom
fix/sso-list-command
Open

fix(cli): decode sso providers when saml id/entity_id are absent#5479
Coly010 wants to merge 1 commit into
developfrom
fix/sso-list-command

Conversation

@Coly010
Copy link
Copy Markdown
Contributor

@Coly010 Coly010 commented Jun 4, 2026

What changed

supabase sso list (and sso show) failed on v2.102.0+ with:

failed to list sso providers: SchemaError(Missing key at ["items"][0]["saml"]["id"])

When sso list was ported to a native TS handler in v2.102.0, it began decoding Management API responses with a strict Effect Schema generated from the OpenAPI spec. The spec over-declares the SSO provider saml descriptor as "required": ["id", "entity_id"], but the real GET /v1/projects/{ref}/config/auth/sso/providers response omits saml.id (and can omit entity_id). Strict decoding therefore rejected a well-formed response. The Go CLI used encoding/json, which silently tolerates missing fields — hence ≤2.101.0 worked.

Why this way

  • The fix lives in the codegen (packages/api/scripts/generate.ts): a documented spec-normalization step relaxes the saml descriptor's required fields for the five SSO provider response schemas (Create/List/Get/Update/DeleteProviderResponse). Request bodies stay strict. This mirrors the existing UUID-pattern patch precedent.
  • The matching change is hand-mirrored into the committed contracts.ts/openapi.json (5 saml blocks). A full regen was not used because the committed generated files carry large pre-existing toolchain drift, which would bury this fix in an unrelated diff.
  • The formatter never reads saml.id and already treats every saml field as optional, so there is no downstream type impact.

A regression test in list.integration.test.ts returns a provider whose saml omits id/entity_id and asserts the command renders — it reproduces the exact error without the schema change.

Follow-up worth filing separately: the upstream Management API OpenAPI spec should not mark saml.id/entity_id as required on these responses.

Fixes #5475

The native `sso list` port (v2.102.0) decodes Management API responses
with a strict Effect Schema generated from the OpenAPI spec. The spec
over-declares the SSO provider `saml` descriptor as
`required: ["id", "entity_id"]`, but the list/get responses omit
`saml.id` (and can omit `entity_id`), so decoding failed with
`SchemaError(Missing key at ["items"][0]["saml"]["id"])`. The Go CLI
tolerated this via `encoding/json`.

Relax the `saml` descriptor's required fields for the five SSO provider
response schemas in the codegen (`generate.ts`) and mirror the change in
the committed `contracts.ts`/`openapi.json`. Request bodies stay strict.

Fixes #5475
@Coly010 Coly010 requested a review from a team as a code owner June 4, 2026 15:22
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase@5479

Preview package for commit a547ad9.

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.

sso list fails with SchemaError in v2.102.0

1 participant