`consumeOne` method not implemented — password reset broken with `better-auth >=1.7.0`
Description
The zenstackAdapter does not implement the consumeOne method, which became required in [email protected]. This causes a BetterAuthError when users attempt to reset their password.
Error
BetterAuthError: Adapter "zenstack" must implement consumeOne for atomic single-use credential consumption.
at factory.mjs:699:68
Steps to Reproduce
- Set up a project with
better-auth@^1.6.26(resolves to1.7.x) and@zenstackhq/[email protected] - Configure email/password with
sendResetPassword - Request a password reset email
- Click the reset link and submit the new password
- The error above is thrown
Expected Behavior
Password reset completes successfully. The consumeOne method should atomically find and delete the single-use token from the verification table.
Environment
@zenstackhq/better-auth:3.9.2better-auth:1.7.1- Provider: PostgreSQL
Notes
[email protected]introducedconsumeOneas a required adapter method for atomic single-use credential consumption (used for password reset tokens and potentially email verification tokens).- The
peerDependenciesallowbetter-auth: "^1.3.0", but the adapter does not work with1.7.x. - As a workaround, I've pinned
better-authto~1.6.26to avoid the breaking change. - This likely affects all versions of
@zenstackhq/better-auth.
Workaround
Pin better-auth to ~1.6.26 in your package.json:
"better-auth": "~1.6.26"
I think this is fixed on the better-auth side now. The "must implement consumeOne" error only exists in @better-auth/core 1.7.0 to 1.7.2. Since 1.7.3 it falls back to findOne plus a guarded deleteMany when an adapter has no consumeOne. I ran the current zenstack adapter unchanged against core 1.7.6 and password reset worked: the first consume returns the row, the second returns null, and the row gets deleted.
So upgrading better-auth to 1.7.3 or later should clear it. A native consumeOne in the adapter would still be nice to have, but it's no longer needed for this to work.