[PR #6921] [CLOSED] fix(session): add dev error logs when adapter join returns null user data #23868

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6921
Author: @tavongamatikiti
Created: 12/21/2025
Status: Closed

Base: canaryHead: fix/session-null-debugging


📝 Commits (1)

  • 21cfe54 fix(session): add dev error logs when adapter join returns null user data

📊 Changes

3 files changed (+86 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/api/routes/session-api.test.ts (+59 -0)
📝 packages/better-auth/src/api/routes/session.ts (+15 -0)
📝 packages/better-auth/src/db/internal-adapter.ts (+12 -1)

📄 Description

Summary by cubic

Added development-only error logs and stricter handling when a session adapter returns missing user join data. getSession now returns null and clears cookies in these cases, with clear debug messages for missing or expired sessions.

  • Bug Fixes
    • Internal adapter logs a clear error in development when user join data is missing and returns null.
    • getSession logs debug messages in development for null lookups and expired sessions; session cookie is cleared.
    • Added a test that simulates a broken adapter join and verifies getSession returns null.

Written for commit 21cfe541bf. Summary will update automatically 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/6921 **Author:** [@tavongamatikiti](https://github.com/tavongamatikiti) **Created:** 12/21/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/session-null-debugging` --- ### 📝 Commits (1) - [`21cfe54`](https://github.com/better-auth/better-auth/commit/21cfe541bf5c172ec563733dc79396a611c01003) fix(session): add dev error logs when adapter join returns null user data ### 📊 Changes **3 files changed** (+86 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/session-api.test.ts` (+59 -0) 📝 `packages/better-auth/src/api/routes/session.ts` (+15 -0) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+12 -1) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Added development-only error logs and stricter handling when a session adapter returns missing user join data. getSession now returns null and clears cookies in these cases, with clear debug messages for missing or expired sessions. - **Bug Fixes** - Internal adapter logs a clear error in development when user join data is missing and returns null. - getSession logs debug messages in development for null lookups and expired sessions; session cookie is cleared. - Added a test that simulates a broken adapter join and verifies getSession returns null. <sup>Written for commit 21cfe541bf5c172ec563733dc79396a611c01003. Summary will update automatically 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:01:53 -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#23868