Skip to content

fix(cors): preserve network error responses - #162

Merged
mandarini merged 1 commit into
supabase:mainfrom
PhuocOng:fix/cors-network-error-response
Sep 15, 2026
Merged

mandarini merged 1 commit into
supabase:mainfrom
PhuocOng:fix/cors-network-error-response

Conversation

@PhuocOng

Copy link
Copy Markdown
Contributor

Summary

Fixes #161.

Preserve Response.error() in addCorsHeaders instead of rebuilding it with status 0, which throws a RangeError. Network-error responses have no HTTP headers to augment; regular HTTP responses keep the existing CORS behavior.

Adds regression coverage for default/custom CORS and the public handler/pipeline forms, plus HTTP 400/500 controls that preserve status, body and CORS headers.

Verification

  • Before the fix: the baseline passes 476 tests; the added regression fails at the Response constructor.
  • Exact PR commit CI: tests, typecheck, lint, build, dependency/exports checks, raw-Node and packed-package smoke tests, and JSR packaging dry-run pass.
  • Ubuntu and Windows: 483 tests pass with no skips, plus typecheck, lint, build and changed-file formatting.
  • Existing E2E suite: all 100 tests pass against disposable Supabase, covering four adapters, core Node and the Deno Edge runtime, with real JWT/JWKS and RLS queries.

The PR's source matches the cross-platform/E2E-tested commit exactly. Additional validation workflow settings remain on the fork and are not part of this PR. Runtime tests ran on GitHub-hosted runners.

AI-assisted with GitHub Copilot.

@PhuocOng
PhuocOng requested review from a team as code owners September 13, 2026 23:02
@pkg-pr-new

pkg-pr-new Bot commented Sep 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@supabase/server@162

commit: 63d579f

@mandarini
mandarini merged commit a0ad38e into supabase:main Sep 15, 2026
6 checks passed
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.

CORS handling throws when given Response.error()

2 participants