[PR #8679] [MERGED] fix(core): prioritize generateId "uuid" over adapter customIdGenerator #25041

Closed
opened 2026-04-15 22:42:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8679
Author: @bytaesu
Created: 3/18/2026
Status: Merged
Merged: 3/18/2026
Merged by: @himself65

Base: canaryHead: 2026-03-19/fix/generate-id-uuid-priority


📝 Commits (2)

  • 87a0e4c fix: prioritize generateId 'uuid' over adapter customIdGenerator
  • 04a4381 test: add cases for get-id-field file

📊 Changes

2 files changed (+237 additions, -4 deletions)

View changed files

packages/core/src/db/adapter/get-id-field.test.ts (+222 -0)
📝 packages/core/src/db/adapter/get-id-field.ts (+15 -4)

📄 Description

Related to https://github.com/better-auth/better-auth/issues/8668

MongoDB uses a customIdGenerator that injects ObjectId().toString(). However, due to the current priority, a user-provided "uuid" option wasn't being applied.

I also slightly refactored the logic for better type narrowing and added tests to lock the behavior.


🔄 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/8679 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 3/18/2026 **Status:** ✅ Merged **Merged:** 3/18/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-03-19/fix/generate-id-uuid-priority` --- ### 📝 Commits (2) - [`87a0e4c`](https://github.com/better-auth/better-auth/commit/87a0e4cc048dc2c0883be90efa859b8052c7e5dd) fix: prioritize generateId 'uuid' over adapter customIdGenerator - [`04a4381`](https://github.com/better-auth/better-auth/commit/04a4381282ec4ad93b35c0f0eb110550a3f3335f) test: add cases for get-id-field file ### 📊 Changes **2 files changed** (+237 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `packages/core/src/db/adapter/get-id-field.test.ts` (+222 -0) 📝 `packages/core/src/db/adapter/get-id-field.ts` (+15 -4) </details> ### 📄 Description Related to https://github.com/better-auth/better-auth/issues/8668 MongoDB uses a customIdGenerator that injects `ObjectId().toString()`. However, due to the current priority, a user-provided `"uuid"` option wasn't being applied. I also slightly refactored the logic for better type narrowing and added tests to lock the behavior. --- <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-15 22:42:08 -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#25041