[PR #5046] [MERGED] fix(adapter): ensure transaction function is implemented in the adapter #31337

Closed
opened 2026-04-17 22:12:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5046
Author: @himself65
Created: 10/2/2025
Status: Merged
Merged: 10/2/2025
Merged by: @himself65

Base: canaryHead: patch/trx


📝 Commits (2)

  • 8f3e0e8 fix(adapter): ensure transaction function is implemented in the adapter
  • 4b87651 Update packages/better-auth/src/db/utils.ts

📊 Changes

1 file changed (+25 additions, -16 deletions)

View changed files

📝 packages/better-auth/src/db/utils.ts (+25 -16)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/5035


Summary by cubic

Guarantees every adapter exposes a transaction function to prevent runtime errors in 1.3.x. Adds a safe fallback with a warning and simplifies getAdapter to always return a valid adapter.

  • Bug Fixes
    • Auto-patch adapter.transaction when missing (warns and uses a pass-through callback).
    • Unified getAdapter flow for memory, functional, and Kysely adapters.
    • Ensures Kysely adapter includes databaseType, debugLogs, and transaction from createKyselyAdapter.

🔄 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/5046 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/2/2025 **Status:** ✅ Merged **Merged:** 10/2/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `patch/trx` --- ### 📝 Commits (2) - [`8f3e0e8`](https://github.com/better-auth/better-auth/commit/8f3e0e80d6f480d4d210efec9af9cf2cdb2a3fb7) fix(adapter): ensure transaction function is implemented in the adapter - [`4b87651`](https://github.com/better-auth/better-auth/commit/4b87651ac61621656a75d9fc8f69ef1cd3ef3f92) Update packages/better-auth/src/db/utils.ts ### 📊 Changes **1 file changed** (+25 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/utils.ts` (+25 -16) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/5035 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Guarantees every adapter exposes a transaction function to prevent runtime errors in 1.3.x. Adds a safe fallback with a warning and simplifies getAdapter to always return a valid adapter. - **Bug Fixes** - Auto-patch adapter.transaction when missing (warns and uses a pass-through callback). - Unified getAdapter flow for memory, functional, and Kysely adapters. - Ensures Kysely adapter includes databaseType, debugLogs, and transaction from createKyselyAdapter. <!-- 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 22:12:56 -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#31337