[PR #7474] [MERGED] fix: handle serial and false cases in generateId #7337

Closed
opened 2026-03-13 13:32:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7474
Author: @bytaesu
Created: 1/19/2026
Status: Merged
Merged: 1/20/2026
Merged by: @himself65

Base: canaryHead: 2026-01-20/fix/handling-generate-id


📝 Commits (3)

  • 7f5a2f8 fix: handle serial and false cases in generateId
  • 2d241f1 fix: handle context generateId false case
  • 5cdabbe fix: just use logical OR fallback

📊 Changes

3 files changed (+52 additions, -6 deletions)

View changed files

📝 packages/better-auth/src/context/create-context.test.ts (+39 -0)
📝 packages/better-auth/src/context/create-context.ts (+9 -2)
📝 packages/better-auth/src/plugins/api-key/routes/create-api-key.ts (+4 -4)

📄 Description

Summary by cubic

Fix generateId to respect database config: 'uuid' returns a UUID; 'serial' or false return false so the DB assigns IDs. Update API key creation to fall back when generateId returns false, and add tests for these cases.

Written for commit 5cdabbe5cf. 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/7474 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/19/2026 **Status:** ✅ Merged **Merged:** 1/20/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-01-20/fix/handling-generate-id` --- ### 📝 Commits (3) - [`7f5a2f8`](https://github.com/better-auth/better-auth/commit/7f5a2f85064f9b5e35e67e5a0f6aa3930a882f3d) fix: handle serial and false cases in generateId - [`2d241f1`](https://github.com/better-auth/better-auth/commit/2d241f19415a5498cd042a4038e9355844123dae) fix: handle context generateId false case - [`5cdabbe`](https://github.com/better-auth/better-auth/commit/5cdabbe5cf0356196fc07df7caa4ac83a322efdc) fix: just use logical OR fallback ### 📊 Changes **3 files changed** (+52 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/context/create-context.test.ts` (+39 -0) 📝 `packages/better-auth/src/context/create-context.ts` (+9 -2) 📝 `packages/better-auth/src/plugins/api-key/routes/create-api-key.ts` (+4 -4) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fix generateId to respect database config: 'uuid' returns a UUID; 'serial' or false return false so the DB assigns IDs. Update API key creation to fall back when generateId returns false, and add tests for these cases. <sup>Written for commit 5cdabbe5cf0356196fc07df7caa4ac83a322efdc. 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-03-13 13:32:36 -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#7337