fix(functions): use error key for JWT verification failures in serve.main.ts#5863
Draft
shkuls wants to merge 2 commits into
Draft
fix(functions): use error key for JWT verification failures in serve.main.ts#5863shkuls wants to merge 2 commits into
shkuls wants to merge 2 commits into
Conversation
…main.ts
The edge-runtime bootstrap template returned JWT verification failures
as { msg: "..." }, inconsistent with the platform gateway's { error: "..." }
shape. Consumers (e.g. Studio's edge function test panel) that check the
error key never see the real failure reason on `supabase start`.
Aligns both JWT-failure paths to { error: "..." }, matching the shape
already used elsewhere in this same file for worker boot/crash errors.
Regenerated the Go CLI's bundled copy of the template (drift-guard test
in serve-main-go-template.unit.test.ts) and added an e2e test that boots
the real bundled template under edge-runtime and asserts on the response
shape for both JWT-failure paths (missing header, wrongly-signed token).
Related: supabase/supabase#47835, supabase/supabase#47836
The container log wait already gates on "Serving functions on" before any request is sent, and Docker's -p port mapping is live from container creation, not app-listen time — the extra waitForServer() HTTP poll was redundant. Matches the existing offline e2e test in this file, which trusts the same log-based readiness signal with no additional HTTP check.
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.
Summary
Aligns JWT-verification failure responses in the edge-runtime bootstrap template (
apps/cli/src/shared/functions/serve.main.ts) from{ msg: "..." }to{ error: "..." }, matching the platform gateway's shape and the{ code, message }shape already used elsewhere in the same file for worker boot/crash errors. Regenerates the legacy Go CLI's bundled copy of the same template (apps/cli-go/internal/functions/serve/templates/main.bundled.js) via the repo's ownpnpm generate:go-serve-templatescript, so the drift-guard test (serve-main-go-template.unit.test.ts) stays green. Adds an e2e test that boots the real bundled template underedge-runtimeand asserts on the response shape for both JWT-failure paths (missing Authorization header, wrongly-signed token).Linked issue
Closes #5861
open-for-contributionlabel.Checklist
fix(functions): …).pnpm testpasses forapps/cli(functions/suite: 6 files, 20 tests).