[PR #7692] [MERGED] fix(api-key): error details not passed to response #33097

Closed
opened 2026-04-17 23:45:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7692
Author: @ping-maxwell
Created: 1/29/2026
Status: Merged
Merged: 2/1/2026
Merged by: @Bekacru

Base: canaryHead: fix/api-key/error-details-not-passed-to-response


📝 Commits (8)

  • d99d775 fix(api-key): error details not passed to response
  • ca92c6e chore: lint
  • f38da41 chore: should keep singleton of ctx (#7654)
  • c51b6ba Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response
  • e98eb98 Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response
  • 5ecb3af Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response
  • 8b5cd6b Update index.ts
  • 371a19b Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response

📊 Changes

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

View changed files

📝 packages/better-auth/src/plugins/api-key/api-key.test.ts (+2 -0)
📝 packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts (+1 -0)

📄 Description

Error details outside of code & message were not returned in the response, so details such as tryAgainIn from rate-limits errors were not returned


Summary by cubic

Pass full error details in verifyApiKey responses so clients can read fields like details.tryAgainIn for rate limit errors. This fixes missing fields beyond code and message.

  • Bug Fixes
    • Spread error.body into the response to include details.
    • Added a test to verify details.tryAgainIn is returned on RATE_LIMITED errors.

Written for commit 371a19bda7. Summary will update on new commits.


🔄 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/7692 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 1/29/2026 **Status:** ✅ Merged **Merged:** 2/1/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/api-key/error-details-not-passed-to-response` --- ### 📝 Commits (8) - [`d99d775`](https://github.com/better-auth/better-auth/commit/d99d7757574f975acd71395c504b5f1efa15e629) fix(api-key): error details not passed to response - [`ca92c6e`](https://github.com/better-auth/better-auth/commit/ca92c6ecffcb7d37497debfaa7bc3ae9727bd229) chore: lint - [`f38da41`](https://github.com/better-auth/better-auth/commit/f38da41c117e0858e16a64223337a399904e3eab) chore: should keep singleton of ctx (#7654) - [`c51b6ba`](https://github.com/better-auth/better-auth/commit/c51b6bae03321f66c19cf9ed456c1cb9e0730c76) Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response - [`e98eb98`](https://github.com/better-auth/better-auth/commit/e98eb980d643f71793bc8f6e89c00653def65628) Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response - [`5ecb3af`](https://github.com/better-auth/better-auth/commit/5ecb3af667056e251ae7ac8e7870c0e069e55710) Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response - [`8b5cd6b`](https://github.com/better-auth/better-auth/commit/8b5cd6be58e470f39f0baaa7a8da07c9a5ca95ce) Update index.ts - [`371a19b`](https://github.com/better-auth/better-auth/commit/371a19bda7c3593a31fd3200d4dbe517af396300) Merge branch 'canary' into fix/api-key/error-details-not-passed-to-response ### 📊 Changes **2 files changed** (+3 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/api-key/api-key.test.ts` (+2 -0) 📝 `packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts` (+1 -0) </details> ### 📄 Description Error details outside of `code` & `message` were not returned in the response, so details such as `tryAgainIn` from rate-limits errors were not returned <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Pass full error details in verifyApiKey responses so clients can read fields like details.tryAgainIn for rate limit errors. This fixes missing fields beyond code and message. - **Bug Fixes** - Spread error.body into the response to include details. - Added a test to verify details.tryAgainIn is returned on RATE_LIMITED errors. <sup>Written for commit 371a19bda7c3593a31fd3200d4dbe517af396300. Summary will update on new commits.</sup> <!-- 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-04-17 23:45:54 -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#33097