Affected area
Edge Functions
Supabase CLI version
Verified against develop (the JWT-verification code path in apps/cli/src/shared/functions/serve.main.ts hasn't changed recently, so this likely affects the latest published release too).
Operating system
N/A — source-level bug in the edge-runtime bootstrap template, reproducible on any OS running supabase functions serve / supabase start.
Command
supabase start
supabase functions serve # or the equivalent local dev worker started by `supabase start`
curl -X POST http://127.0.0.1:<port>/<function-with-verify_jwt-true>
Actual output
Expected behavior
matching the shape the platform edge-runtime gateway returns, and the shape already used elsewhere in the same file (serve.main.ts) for worker boot/crash errors ({ code, message }).
Steps to reproduce
supabase start
- Deploy or serve a function with
verify_jwt = true.
- Send a request with no
Authorization header, or an invalid/wrongly-signed JWT.
- Observe the response body uses
{"msg": "..."} instead of {"error": "..."}.
This means any consumer that reads the error key (matching the platform gateway's shape) never sees the real failure reason on supabase start — it silently falls through to a generic fallback message instead. This is exactly what happened in Supabase Studio's edge function test panel: see supabase/supabase#47835 for the full repro and root-cause writeup, and supabase/supabase#47836 for the Studio-side fix.
Additional context
@aantti requested fixing this at the source (this worker) rather than only patching Studio's error parsing — see the discussion on supabase/supabase#47836.
A fix is ready: two msg → error occurrences in apps/cli/src/shared/functions/serve.main.ts, plus the legacy Go CLI's bundled copy of the same template regenerated via the repo's own pnpm generate:go-serve-template script (kept in sync via the drift-guard test in serve-main-go-template.unit.test.ts), plus a new e2e test (serve-main-jwt-error-shape.e2e.test.ts) that boots the real bundled worker under edge-runtime and asserts on the response shape for both JWT-failure paths. Full functions/ test suite passes (6 files, 20 tests). Happy to open the PR once this issue is triaged and labeled open-for-contribution, per CONTRIBUTING.md.
Affected area
Edge Functions
Supabase CLI version
Verified against
develop(the JWT-verification code path inapps/cli/src/shared/functions/serve.main.tshasn't changed recently, so this likely affects the latest published release too).Operating system
N/A — source-level bug in the edge-runtime bootstrap template, reproducible on any OS running
supabase functions serve/supabase start.Command
Actual output
{"msg":"Invalid JWT"}Expected behavior
{"error":"Invalid JWT"}matching the shape the platform edge-runtime gateway returns, and the shape already used elsewhere in the same file (
serve.main.ts) for worker boot/crash errors ({ code, message }).Steps to reproduce
supabase startverify_jwt = true.Authorizationheader, or an invalid/wrongly-signed JWT.{"msg": "..."}instead of{"error": "..."}.This means any consumer that reads the
errorkey (matching the platform gateway's shape) never sees the real failure reason onsupabase start— it silently falls through to a generic fallback message instead. This is exactly what happened in Supabase Studio's edge function test panel: see supabase/supabase#47835 for the full repro and root-cause writeup, and supabase/supabase#47836 for the Studio-side fix.Additional context
@aanttirequested fixing this at the source (this worker) rather than only patching Studio's error parsing — see the discussion on supabase/supabase#47836.A fix is ready: two
msg→erroroccurrences inapps/cli/src/shared/functions/serve.main.ts, plus the legacy Go CLI's bundled copy of the same template regenerated via the repo's ownpnpm generate:go-serve-templatescript (kept in sync via the drift-guard test inserve-main-go-template.unit.test.ts), plus a new e2e test (serve-main-jwt-error-shape.e2e.test.ts) that boots the real bundled worker underedge-runtimeand asserts on the response shape for both JWT-failure paths. Fullfunctions/test suite passes (6 files, 20 tests). Happy to open the PR once this issue is triaged and labeledopen-for-contribution, per CONTRIBUTING.md.