[PR #1747] [CLOSED] fix(drizzle adapter): count returning undefined #12219

Closed
opened 2026-04-13 08:14:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1747
Author: @Creaous
Created: 3/9/2025
Status: Closed

Base: mainHead: fix-drizzle-adapter-count-issue


📝 Commits (1)

  • 1a3261a fix(drizzle adapter): count returning undefined

📊 Changes

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

View changed files

📝 packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts (+1 -1)

📄 Description

During the creation of a custom plugin that I am working on, I found out that the Drizzle adapter count function would return undefined. This is due to the count function in Drizzle returning with [{ count: 1 }] instead of { count: 1 }. This pull request changes res.count to res[0].count which fixes this issue.

Example issue repository (uses internalAdapter.countTotalUsers()): https://github.com/Creaous/better-auth-drizzle-count-issue


🔄 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/1747 **Author:** [@Creaous](https://github.com/Creaous) **Created:** 3/9/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-drizzle-adapter-count-issue` --- ### 📝 Commits (1) - [`1a3261a`](https://github.com/better-auth/better-auth/commit/1a3261a02129e73f7c9ce0628084c9b125494ddc) fix(drizzle adapter): count returning undefined ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts` (+1 -1) </details> ### 📄 Description During the creation of a custom plugin that I am working on, I found out that the Drizzle adapter count function would return undefined. This is due to the count function in Drizzle returning with `[{ count: 1 }]` instead of `{ count: 1 }`. This pull request changes `res.count` to `res[0].count` which fixes this issue. Example issue repository (uses `internalAdapter.countTotalUsers()`): https://github.com/Creaous/better-auth-drizzle-count-issue --- <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-13 08:14:22 -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#12219