Skip to content

fix(auth): add toJSON to WebAuthnError for correct JSON serialization - #2307

Closed
oniani1 wants to merge 1 commit into
supabase:masterfrom
oniani1:fix/auth-webauthn-error-tojson
Closed

oniani1 wants to merge 1 commit into
supabase:masterfrom
oniani1:fix/auth-webauthn-error-tojson

Conversation

@oniani1

@oniani1 oniani1 commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

WebAuthnError and WebAuthnUnknownError extend Error, so JSON.stringify produces an object missing message, name, and code (those props are non-enumerable on Error). AuthError, FunctionsError, StorageError, and several other auth error subclasses already have toJSON; the WebAuthn classes added in #2283 missed it.

Adds a toJSON to WebAuthnError returning { name, message, code }. WebAuthnUnknownError inherits the method, so its originalError is no longer surfaced in serialized form.

Tests in test/webauthn.errors.test.ts cover both classes and confirm the inherited path doesn't leak originalError.

Closes #2306

@oniani1
oniani1 requested review from a team as code owners April 29, 2026 20:19
@pkg-pr-new

pkg-pr-new Bot commented Apr 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2307

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2307

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2307

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2307

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2307

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2307

commit: 9ac35f1

@mandarini
mandarini changed the base branch from master to develop May 4, 2026 11:10
@mandarini
mandarini requested review from a team as code owners May 4, 2026 11:10
@mandarini
mandarini changed the base branch from develop to master May 4, 2026 11:11
@mandarini

Copy link
Copy Markdown
Contributor

moved here #2313

@mandarini mandarini closed this May 4, 2026
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.

2 participants