[PR #5682] fix(adapter): drizzle deleteMany result should be a number #14402

Closed
opened 2026-04-13 09:27:24 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5682

State: closed
Merged: Yes


For Neon drizzle driver, the result is an object with other data. We expect the result of deleteMany to be a number representing the number of rows deleted. This PR fixes this specific bug with neon driver, as well as having additional code to catch unexpected cases with non-numeric return values to warn in the console for them to open an issue as that's not expected.


Summary by cubic

Fixes deleteMany in the Drizzle adapter to always return the number of deleted rows. Normalizes Neon driver’s object result and adds safeguards for unexpected return shapes.

  • Bug Fixes
    • Normalize deleteMany results: use rowCount, array length, affectedRows, rowsAffected, or changes to compute a number.
    • Log an error with context if the result isn’t numeric to surface adapter issues.

Written for commit a1b3ba18eb. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5682 **State:** closed **Merged:** Yes --- For Neon drizzle driver, the result is an object with other data. We expect the result of `deleteMany` to be a number representing the number of rows deleted. This PR fixes this specific bug with neon driver, as well as having additional code to catch unexpected cases with non-numeric return values to warn in the console for them to open an issue as that's not expected. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes deleteMany in the Drizzle adapter to always return the number of deleted rows. Normalizes Neon driver’s object result and adds safeguards for unexpected return shapes. - **Bug Fixes** - Normalize deleteMany results: use rowCount, array length, affectedRows, rowsAffected, or changes to compute a number. - Log an error with context if the result isn’t numeric to surface adapter issues. <sup>Written for commit a1b3ba18ebb25b4782325f58030f5a862a031f69. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:27:24 -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#14402