[PR #5079] [MERGED] fix(passkey): passkey breaks with throw: true #5759

Closed
opened 2026-03-13 12:34:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5079
Author: @ping-maxwell
Created: 10/4/2025
Status: Merged
Merged: 10/9/2025
Merged by: @Bekacru

Base: canaryHead: fix/passkey-breaks-with-throw-true


📝 Commits (8)

  • 2054347 fix(passkey): passkey breaks with throw: true
  • a0d72e0 Merge branch 'canary' into fix/passkey-breaks-with-throw-true
  • 3083f1e Merge branch 'canary' into fix/passkey-breaks-with-throw-true
  • 3819b70 Merge branch 'canary' into fix/passkey-breaks-with-throw-true
  • cc633e7 Merge branch 'canary' into fix/passkey-breaks-with-throw-true
  • 1b5571c fix: remove client optoins
  • 1c36e39 add disclaimer
  • ab9db21 Merge branch 'canary' into fix/passkey-breaks-with-throw-true

📊 Changes

2 files changed (+10 additions, -0 deletions)

View changed files

📝 docs/content/docs/plugins/passkey.mdx (+4 -0)
📝 packages/better-auth/src/plugins/passkey/client.ts (+6 -0)

📄 Description

When throw: true is configured and is using the passkey plugin, then the result type is unexpected and thus breaks the logic in our client plugin. This PR addresses this by forcefully setting throw to false, then providing the data as usual, and if there is an error it will handle throwing the error by itself - rather than relying on the authClient.

issue: https://github.com/better-auth/better-auth/issues/2542
linear: https://linear.app/better-auth/issue/ENG-129/fix-passkey-client-returns-options-when-fetch-throws-with-throw-true


Summary by cubic

Fix passkey client behavior with throw: true by making internal requests non-throwing and conditionally rethrowing errors. This keeps response types stable and unblocks passkey sign-in and registration.

  • Bug Fixes
    • Always call $fetch with throw: false for generate and verify endpoints.
    • Compute shouldThrowOnError from options, fetchOptions, and ClientOptions; rethrow only when expected.
    • Return consistent data/error shapes so client logic no longer breaks with throw enabled.
    • Pass ClientOptions into getPasskeyActions to honor global throw config. Addresses Linear ENG-129.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5079 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 10/4/2025 **Status:** ✅ Merged **Merged:** 10/9/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/passkey-breaks-with-throw-true` --- ### 📝 Commits (8) - [`2054347`](https://github.com/better-auth/better-auth/commit/2054347b438f45c927765f223c82cb21d1e26874) fix(passkey): passkey breaks with `throw: true` - [`a0d72e0`](https://github.com/better-auth/better-auth/commit/a0d72e06b47a798b2a482b0f2346525d68cbd2f6) Merge branch 'canary' into fix/passkey-breaks-with-throw-true - [`3083f1e`](https://github.com/better-auth/better-auth/commit/3083f1e7dfc231b5454816a0dffd0f4ea896a985) Merge branch 'canary' into fix/passkey-breaks-with-throw-true - [`3819b70`](https://github.com/better-auth/better-auth/commit/3819b70ed92405f8357ae190586973367777ec97) Merge branch 'canary' into fix/passkey-breaks-with-throw-true - [`cc633e7`](https://github.com/better-auth/better-auth/commit/cc633e711b79ce9773686c68aae64b01ab5a7162) Merge branch 'canary' into fix/passkey-breaks-with-throw-true - [`1b5571c`](https://github.com/better-auth/better-auth/commit/1b5571cf46f55403ca4af9efac41da69deb60065) fix: remove client optoins - [`1c36e39`](https://github.com/better-auth/better-auth/commit/1c36e3934336723e1f969a0528a67ea13ff504e0) add disclaimer - [`ab9db21`](https://github.com/better-auth/better-auth/commit/ab9db21bece8c26bc73a1f452a472a9ae26f6212) Merge branch 'canary' into fix/passkey-breaks-with-throw-true ### 📊 Changes **2 files changed** (+10 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/passkey.mdx` (+4 -0) 📝 `packages/better-auth/src/plugins/passkey/client.ts` (+6 -0) </details> ### 📄 Description When `throw: true` is configured and is using the passkey plugin, then the result type is unexpected and thus breaks the logic in our client plugin. This PR addresses this by forcefully setting throw to false, then providing the data as usual, and if there is an error it will handle throwing the error by itself - rather than relying on the authClient. issue: https://github.com/better-auth/better-auth/issues/2542 linear: https://linear.app/better-auth/issue/ENG-129/fix-passkey-client-returns-options-when-fetch-throws-with-throw-true <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fix passkey client behavior with throw: true by making internal requests non-throwing and conditionally rethrowing errors. This keeps response types stable and unblocks passkey sign-in and registration. - **Bug Fixes** - Always call $fetch with throw: false for generate and verify endpoints. - Compute shouldThrowOnError from options, fetchOptions, and ClientOptions; rethrow only when expected. - Return consistent data/error shapes so client logic no longer breaks with throw enabled. - Pass ClientOptions into getPasskeyActions to honor global throw config. Addresses Linear ENG-129. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:34:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5759