[PR #4093] [CLOSED] fix(api-key): avoid blocking verification with delete and update operations #5184

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4093
Author: @Bekacru
Created: 8/19/2025
Status: Closed

Base: canaryHead: fix/api-key-blocking


📝 Commits (2)

  • dbb58cb avoid blocking delete and update for api keys
  • e04a53c Merge branch 'canary' into fix/api-key-blocking

📊 Changes

1 file changed (+8 additions, -10 deletions)

View changed files

📝 packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts (+8 -10)

📄 Description

Summary by cubic

Make API key verification non-blocking. Updates and expired-key cleanup now run in the background to avoid slow adapters blocking requests and to reduce latency.

  • Bug Fixes
    • Stop awaiting adapter.update in validateApiKey and remove the hard failure when it returns null; return the merged key state instead.
    • Call deleteAllExpiredApiKeys without await so cleanup doesn’t block verification.

🔄 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/4093 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 8/19/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/api-key-blocking` --- ### 📝 Commits (2) - [`dbb58cb`](https://github.com/better-auth/better-auth/commit/dbb58cbb786599c32f775bc719a2510839060b28) avoid blocking delete and update for api keys - [`e04a53c`](https://github.com/better-auth/better-auth/commit/e04a53cdeb1f6131fc15ac97471a7184e7469eaf) Merge branch 'canary' into fix/api-key-blocking ### 📊 Changes **1 file changed** (+8 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts` (+8 -10) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Make API key verification non-blocking. Updates and expired-key cleanup now run in the background to avoid slow adapters blocking requests and to reduce latency. - **Bug Fixes** - Stop awaiting adapter.update in validateApiKey and remove the hard failure when it returns null; return the merged key state instead. - Call deleteAllExpiredApiKeys without await so cleanup doesn’t block verification. <!-- 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:13:17 -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#5184