[PR #6617] [MERGED] fix(adapter): allow run internal adapter outside context #23682

Closed
opened 2026-04-15 21:54:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6617
Author: @himself65
Created: 12/8/2025
Status: Merged
Merged: 12/8/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/12/09/ignore-if-no-context


📝 Commits (4)

📊 Changes

3 files changed (+101 additions, -138 deletions)

View changed files

📝 packages/better-auth/src/db/internal-adapter.test.ts (+72 -109)
📝 packages/better-auth/src/db/with-hooks.ts (+5 -5)
📝 packages/core/src/types/init-options.ts (+24 -24)

📄 Description

Summary by cubic

Allows the internal DB adapter to run when no auth context is available. Hooks now receive a null context instead of throwing, preventing crashes in background jobs and tests.

  • Bug Fixes
    • Treat missing auth context as null and pass it to hooks; update hook types accordingly.
    • Keep existing behavior and data merging when context is present.

Written for commit 4c3ac9c774. 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/6617 **Author:** [@himself65](https://github.com/himself65) **Created:** 12/8/2025 **Status:** ✅ Merged **Merged:** 12/8/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/12/09/ignore-if-no-context` --- ### 📝 Commits (4) - [`292bee6`](https://github.com/better-auth/better-auth/commit/292bee6a015680ef0c90b2ef40cf1e4313449903) fix(adapter): allow run internal adapter outside context - [`c6b68fd`](https://github.com/better-auth/better-auth/commit/c6b68fd473f4c11d6c4f37f3947af2a46c98f5fd) test: fix - [`b0934d1`](https://github.com/better-auth/better-auth/commit/b0934d1df852e0e5d9cbbcebe2e0e8bd233d02ec) fix: test - [`4c3ac9c`](https://github.com/better-auth/better-auth/commit/4c3ac9c7743ccab02fed9b411b2797c210546823) fix: test ### 📊 Changes **3 files changed** (+101 additions, -138 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/internal-adapter.test.ts` (+72 -109) 📝 `packages/better-auth/src/db/with-hooks.ts` (+5 -5) 📝 `packages/core/src/types/init-options.ts` (+24 -24) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Allows the internal DB adapter to run when no auth context is available. Hooks now receive a null context instead of throwing, preventing crashes in background jobs and tests. - **Bug Fixes** - Treat missing auth context as null and pass it to hooks; update hook types accordingly. - Keep existing behavior and data merging when context is present. <sup>Written for commit 4c3ac9c7743ccab02fed9b411b2797c210546823. 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 21:54:34 -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#23682