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

Closed
opened 2026-04-17 23:21:18 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: mainHead: fix/session-null-debugging


📝 Commits (2)

  • 46b893c fix(session): add dev error logs when adapter join returns null user data
  • a830ac1 Merge branch 'main' into fix/session-null-debugging

📊 Changes

3 files changed (+89 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/api/routes/session-api.test.ts (+59 -0)
📝 packages/better-auth/src/api/routes/session.ts (+17 -2)
📝 packages/better-auth/src/db/internal-adapter.ts (+13 -3)

📄 Description

Fix issue: client.getSession returned null, but session exist #6672- https://github.com/better-auth/better-auth/issues/6672


Summary by cubic

Improves session debugging in development by logging when adapters return sessions without joined user data, and makes getSession return null in that case.

  • Bug Fixes

    • getSession now returns null when the adapter returns a session missing user join data.
    • Added a test for the broken join scenario.
  • New Features

    • Dev-only debug logs in getSession for null and expired sessions.
    • Dev-only error logs in the internal adapter when user join data is missing, with guidance for adapter implementations.

Written for commit a830ac1745. 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/6922 **Author:** [@tavongamatikiti](https://github.com/tavongamatikiti) **Created:** 12/21/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/session-null-debugging` --- ### 📝 Commits (2) - [`46b893c`](https://github.com/better-auth/better-auth/commit/46b893c26d62652bfd59030651f08ebaa5c190a1) fix(session): add dev error logs when adapter join returns null user data - [`a830ac1`](https://github.com/better-auth/better-auth/commit/a830ac1745302b4112e70eec3bbeab67307d33c7) Merge branch 'main' into fix/session-null-debugging ### 📊 Changes **3 files changed** (+89 additions, -5 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` (+17 -2) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+13 -3) </details> ### 📄 Description Fix issue: client.getSession returned null, but session exist #6672- https://github.com/better-auth/better-auth/issues/6672 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Improves session debugging in development by logging when adapters return sessions without joined user data, and makes getSession return null in that case. - **Bug Fixes** - getSession now returns null when the adapter returns a session missing user join data. - Added a test for the broken join scenario. - **New Features** - Dev-only debug logs in getSession for null and expired sessions. - Dev-only error logs in the internal adapter when user join data is missing, with guidance for adapter implementations. <sup>Written for commit a830ac1745302b4112e70eec3bbeab67307d33c7. 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-17 23:21:18 -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#32569