[PR #5804] fix(internal-adapter): initialize and persist plugin session fields in secondary storage #14483

Closed
opened 2026-04-13 09:29:52 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5804

State: closed
Merged: No


This PR fixes an issue where additional session fields in the plugin disappear when using secondary storage.


Summary by cubic

Fixes loss of plugin-defined session fields when using secondary storage. Plugin fields are now initialized and persisted so findSession returns them reliably.

  • Bug Fixes
    • Initialize plugin session fields on create (evaluate function defaultValue; use null for optional fields).
    • Persist updates to secondary storage with a TTL derived from expiresAt.
    • Ensure findSession reads plugin fields when sessions are stored only in secondary storage.
    • Added tests for initialization, update preservation, and retrieval.

Written for commit dce204cdd3. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5804 **State:** closed **Merged:** No --- This PR fixes an issue where additional session fields in the plugin disappear when using secondary storage. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes loss of plugin-defined session fields when using secondary storage. Plugin fields are now initialized and persisted so findSession returns them reliably. - **Bug Fixes** - Initialize plugin session fields on create (evaluate function defaultValue; use null for optional fields). - Persist updates to secondary storage with a TTL derived from expiresAt. - Ensure findSession reads plugin fields when sessions are stored only in secondary storage. - Added tests for initialization, update preservation, and retrieval. <sup>Written for commit dce204cdd3f4e8101e014121772c4be5c17b24ca. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:29:52 -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#14483