fix(cli): honor SUPABASE_INTERNAL_IMAGE_REGISTRY in gen types - #5786
Merged
jgoux merged 3 commits intoJul 6, 2026
Merged
Conversation
`supabase gen types --local` spawns postgres-meta via a direct `docker run public.ecr.aws/supabase/postgres-meta:<tag>` and ignores `SUPABASE_INTERNAL_IMAGE_REGISTRY` for any value other than `docker.io`. `resolvePgmetaImage` only special-cased `docker.io` and otherwise fell through to `dockerImageForService`, whose registry is hardcoded to `public.ecr.aws/supabase`. On shared GitHub runners `supabase/setup-cli` exports `SUPABASE_INTERNAL_IMAGE_REGISTRY=ghcr.io` precisely to avoid ECR throttling, but gen types kept pulling from ECR and failed with `docker: toomanyrequests: Rate exceeded`. The Go CLI honored the override via `GetRegistryImageUrl` (with multi-registry fallback). Resolve the image through the existing `legacyGetRegistryImageUrl` helper (the 1:1 TS port of Go's `GetRegistryImageUrl`, already used by `supabase start` / `test db`), so the override is honored for any registry while ECR stays the default when unset. Output is unchanged for the unset and `docker.io` cases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jgoux
approved these changes
Jul 6, 2026
jgoux
left a comment
Contributor
There was a problem hiding this comment.
Thanks for your contribution! 🙏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Make
supabase gen types --localhonorSUPABASE_INTERNAL_IMAGE_REGISTRYfor any registry when pulling thepostgres-metaimage, instead of only special-casingdocker.io.Closes #5785.
Why
On GitHub-hosted runners (shared egress IPs),
public.ecr.awsis frequently rate-limited.supabase/setup-cliexportsSUPABASE_INTERNAL_IMAGE_REGISTRY=ghcr.ioprecisely to avoid this (core.exportVariable(CLI_CONFIG_REGISTRY, "ghcr.io")).supabase starthonors it, butgen typesdid not: it kept runningdocker run public.ecr.aws/supabase/postgres-meta:<tag>and failed witheven with
SUPABASE_INTERNAL_IMAGE_REGISTRY=ghcr.ioset in the step env.Root cause
apps/cli/src/legacy/commands/gen/types/types.handler.ts—runPgMetaspawns the container withresolvePgmetaImage(...).apps/cli/src/legacy/commands/gen/types/types.shared.ts—resolvePgmetaImageonly special-casedSUPABASE_INTERNAL_IMAGE_REGISTRY === "docker.io"; any other value fell through todockerImageForService.packages/stack/src/versions.ts—dockerImageForServicehardcodesDEFAULT_REGISTRY = "public.ecr.aws/supabase"and does not read the env var.The Go CLI honored the override (with multi-registry fallback) via
GetRegistryImageUrlinapps/cli-go/internal/utils/docker.go, so this is a regression in the TypeScript rewrite.How
Resolve the image through the existing
legacyGetRegistryImageUrlhelper (apps/cli/src/legacy/shared/legacy-docker-registry.ts) — the documented 1:1 port of Go'sGetRegistryImageUrl, already used bysupabase startandtest db(test/db/db.handler.tsforpg_prove). It honorsSUPABASE_INTERNAL_IMAGE_REGISTRYfor any registry, returns Docker Hub images unchanged fordocker.io, and defaults to the ECR mirror when unset.Output is unchanged in the two pre-existing cases:
SUPABASE_INTERNAL_IMAGE_REGISTRYpublic.ecr.aws/supabase/postgres-meta:v<tag>public.ecr.aws/supabase/postgres-meta:v<tag>docker.iosupabase/postgres-meta:v<tag>supabase/postgres-meta:v<tag>ghcr.iopublic.ecr.aws/supabase/postgres-meta:v<tag>❌ghcr.io/supabase/postgres-meta:v<tag>✅my.registrypublic.ecr.aws/supabase/postgres-meta:v<tag>❌my.registry/supabase/postgres-meta:v<tag>✅Tests
Added regression guards in
types.unit.test.tsfor the default (ECR),ghcr.io, and an arbitrary mirror. Theghcr.iocase fails against the old code.types.unit.test.ts: 26/26 passtypes.integration.test.ts: 71/71 passtypes:check/lint:check/fmt:check/knip:check: clean