[PR #7476] [MERGED] fix: ensure session id exists for secondary storage without database #24240

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

📋 Pull Request Information

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

Base: canaryHead: 2026-01-20/fix/session-id-secondary-storage


📝 Commits (3)

  • a7f4c58 fix: ensure session id exists for secondary storage without database
  • 54b6b76 fix: revert using override id
  • e8cba0b chore: move comment

📊 Changes

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

View changed files

📝 packages/better-auth/src/db/internal-adapter.test.ts (+5 -0)
📝 packages/better-auth/src/db/internal-adapter.ts (+30 -10)

📄 Description


Summary by cubic

Ensures session.id is always set when using secondary storage without a database, preventing undefined IDs and broken session creation.

  • Bug Fixes
    • Generate a session ID when storeSessionInDatabase is false and secondary storage is used, using ctx.generateId or a local fallback.
    • Ignore any override id; always include the new id in session data. Pass storeInDb to executeMainFn.
    • Add a test asserting session.id exists and is a string.

Written for commit e8cba0b14d. 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/7476 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/20/2026 **Status:** ✅ Merged **Merged:** 1/20/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-01-20/fix/session-id-secondary-storage` --- ### 📝 Commits (3) - [`a7f4c58`](https://github.com/better-auth/better-auth/commit/a7f4c58a884efb41bd2ef4376dd406f9d1a2013e) fix: ensure session id exists for secondary storage without database - [`54b6b76`](https://github.com/better-auth/better-auth/commit/54b6b76cbbc5c6ed1343f0eb9634c118f6950689) fix: revert using override id - [`e8cba0b`](https://github.com/better-auth/better-auth/commit/e8cba0b14d6f6ee490f938e9af6157316a834dbf) chore: move comment ### 📊 Changes **2 files changed** (+35 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/internal-adapter.test.ts` (+5 -0) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+30 -10) </details> ### 📄 Description - Closes https://github.com/better-auth/better-auth/issues/7454 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Ensures session.id is always set when using secondary storage without a database, preventing undefined IDs and broken session creation. - **Bug Fixes** - Generate a session ID when storeSessionInDatabase is false and secondary storage is used, using ctx.generateId or a local fallback. - Ignore any override id; always include the new id in session data. Pass storeInDb to executeMainFn. - Add a test asserting session.id exists and is a string. <sup>Written for commit e8cba0b14d6f6ee490f938e9af6157316a834dbf. 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-15 22:15:15 -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#24240