Kysely deleteMany always returns 1
Hello!
I came across this when trying to build out a way to require my approval before a user can sign up. I created a minimal plugin that tells better-auth about my extra table, and I'd like to check and delete the appropriate row in the user.create.before databaseHook:
My goal is to tie in to the existing better-auth postgres transaction so that throwing an error here or in the
I'm new to better-auth and kysely, but I believe the issue is here: https://github.com/better-auth/better-auth/blob/b1ea1f520f504923e592910e959b057629908b9c/packages/better-auth/src/adapters/kysely-adapter/kysely-adapter.ts#L575-L585
For Kysely, I think you'd need to check
I'm using the latest version of better-auth and kysely.
Let me know if you need any more info. Thanks!
I came across this when trying to build out a way to require my approval before a user can sign up. I created a minimal plugin that tells better-auth about my extra table, and I'd like to check and delete the appropriate row in the user.create.before databaseHook:
result here is always 1 (even if you replace value: user.email with value: "DOES-NOT-EXIST"My goal is to tie in to the existing better-auth postgres transaction so that throwing an error here or in the
after hook (or if there is an issue with signing up the user) leaves the approved_signup_emails record in the database. Using getCurrentAdapter seems to accomplish this, but please let me know if there's a more recommended path.I'm new to better-auth and kysely, but I believe the issue is here: https://github.com/better-auth/better-auth/blob/b1ea1f520f504923e592910e959b057629908b9c/packages/better-auth/src/adapters/kysely-adapter/kysely-adapter.ts#L575-L585
For Kysely, I think you'd need to check
.numDeletedRows of the result rather than just taking the length. I haven't dug into it, but I think there is a similar issue with updateMany.I'm using the latest version of better-auth and kysely.
Let me know if you need any more info. Thanks!
GitHub
The most comprehensive authentication framework for TypeScript - better-auth/better-auth