fix(cli): bundle the Go edge-runtime template for offline supabase start#5682
Merged
Conversation
`supabase start` proxies to the Go binary, whose edge-runtime bootstrap template (`templates/main.ts`) still imported `deno.land/std` and `jsr:@panva/jose` over the network on every start — so start crashed offline even after the TS `functions serve` fix (supabase/supabase#45570). Unify on a single template: the Go binary now embeds the bundle of the canonical `apps/cli/src/shared/functions/serve.main.ts` (jose + std deps inlined), generated by `scripts/generate-go-serve-template.ts` and committed as `templates/main.bundled.js`. The duplicate Go `templates/main.ts` is deleted. A unit test regenerates the bundle and fails if the committed artifact drifts, so the two CLIs can't diverge again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@aeaa67266a81554d05b9b2e98a147e03b7112ce4Preview package for commit |
Coly010
approved these changes
Jun 24, 2026
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
Makes
supabase startstart its edge-runtime offline. Follow-up to #5678, which fixedsupabase functions servebut notsupabase start.Why a second PR was needed
#5678 fixed the TS template (
functions serve, which is a native TS port). Butsupabase startiswrapped— the legacy shell proxies it to the Go binary (start.handler.ts → start.go:1054serve.ServeFunctions). Go's edge-runtime embedded its own copy of the bootstrap template (apps/cli-go/internal/functions/serve/templates/main.ts), which still importedhttps://deno.land/std/...andjsr:@panva/jose@6. So defaultsupabase start(edge-runtime enabled) still crashed offline with thestatus.tsDNS error from supabase/supabase#45570.The root cause of the gap was two copies of the same template, only one of which was fixed.
How
Unify on a single source of truth:
go:embedstemplates/main.bundled.js— the bundle of the canonicalapps/cli/src/shared/functions/serve.main.ts(jose + std deps inlined, no remote specifiers), reusing the samebundleServeMainTemplate()from fix(cli): serve edge functions offline by bundling the runtime template #5678.scripts/generate-go-serve-template.ts(pnpm generate:go-serve-template) to produce the committed artifact. It's committed becausego build/go test/CI have no JS toolchain.templates/main.ts.serve.main.ts— so the two CLIs can't silently diverge again.deno.land/jsr:) instead of asserting the old remote imports.The container launch path is unchanged — Go still heredocs the template into
/root/index.tsand runsedge-runtime start --main-service=/root; only the embedded contents differ (now the offline bundle).Relationship to other fixes
og-images) in the supabase/supabase repo. Different layer.supabase functions serveandsupabase startnow run edge functions offline, closing Supabase fails to run offline without an internet connection supabase#45570.