[PR #8374] [CLOSED] fix: handle string session expiry in secondary storage refresh #7930

Closed
opened 2026-03-13 13:53:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8374
Author: @Oluwatobi-Mustapha
Created: 3/4/2026
Status: Closed

Base: canaryHead: fix/secondary-storage-refresh-string-expiry-8156


📝 Commits (3)

  • 58cd04c fix: handle string session expiry in secondary storage refresh
  • b465b55 Merge branch 'canary' into fix/secondary-storage-refresh-string-expiry-8156
  • 7765e1a Merge branch 'canary' into fix/secondary-storage-refresh-string-expiry-8156

📊 Changes

3 files changed (+132 additions, -3 deletions)

View changed files

📝 packages/better-auth/src/api/routes/update-user.test.ts (+56 -0)
📝 packages/better-auth/src/db/internal-adapter.test.ts (+56 -0)
📝 packages/better-auth/src/db/internal-adapter.ts (+20 -3)

📄 Description

Fixes #8156

Handle secondary-storage session expiry values returned as strings when storage returns parsed objects.

  • Make TTL calculation robust to Date | number | string expiry values.
  • Prevent crashes in session refresh during updateUser and updateUserByEmail.
  • Add regression tests at adapter and route levels for object-return secondary storage with string date fields.

Summary by cubic

Handles string-based session expiry from secondary storage when cached objects are returned. Prevents refresh errors during updateUser/updateUserByEmail and ensures updates propagate across multiple sessions. Fixes #8156.

  • Bug Fixes
    • Make TTL calculation accept Date/number/string expiry and fall back to 0 when invalid.
    • Add adapter and route tests for object-return secondary storage with string date fields; verify refresh and propagation for updateUser/updateUserByEmail across multiple sessions.

Written for commit 7765e1a4c9. 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/8374 **Author:** [@Oluwatobi-Mustapha](https://github.com/Oluwatobi-Mustapha) **Created:** 3/4/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/secondary-storage-refresh-string-expiry-8156` --- ### 📝 Commits (3) - [`58cd04c`](https://github.com/better-auth/better-auth/commit/58cd04c108658e51509e4e2fcb88b4df4483b3fa) fix: handle string session expiry in secondary storage refresh - [`b465b55`](https://github.com/better-auth/better-auth/commit/b465b557afe53bb9d404e8858d19b5760f1791ff) Merge branch 'canary' into fix/secondary-storage-refresh-string-expiry-8156 - [`7765e1a`](https://github.com/better-auth/better-auth/commit/7765e1a4c9825dada589c872cbb725ee4e6e3198) Merge branch 'canary' into fix/secondary-storage-refresh-string-expiry-8156 ### 📊 Changes **3 files changed** (+132 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/update-user.test.ts` (+56 -0) 📝 `packages/better-auth/src/db/internal-adapter.test.ts` (+56 -0) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+20 -3) </details> ### 📄 Description Fixes #8156 Handle secondary-storage session expiry values returned as strings when storage returns parsed objects. - Make TTL calculation robust to `Date | number | string` expiry values. - Prevent crashes in session refresh during `updateUser` and `updateUserByEmail`. - Add regression tests at adapter and route levels for object-return secondary storage with string date fields. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Handles string-based session expiry from secondary storage when cached objects are returned. Prevents refresh errors during updateUser/updateUserByEmail and ensures updates propagate across multiple sessions. Fixes #8156. - **Bug Fixes** - Make TTL calculation accept Date/number/string expiry and fall back to 0 when invalid. - Add adapter and route tests for object-return secondary storage with string date fields; verify refresh and propagation for updateUser/updateUserByEmail across multiple sessions. <sup>Written for commit 7765e1a4c9825dada589c872cbb725ee4e6e3198. 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:53:37 -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#7930