Unable to sign up using email / password
I keep getting this error when I sign up using email password in my next.js app
auth.ts
db.ts
21 Replies
schema.prisma
cc: @bekacru
you have
password_hash
field that's required in your user table first you should remove that. passwords are stored in the account table.I have not generate this schema, it's generated by better auth cli
should I manually modify it?
No better auth cli wouldn’t add that field.
And when I try using it github i get this error,
Maybe you have defined it as additional field
Remove the field, push and regenerate the client
let me just remove it and create it from scratch
you were right, it removed that field!
but weirdly now i get 500 error as soon as I hit my sign in page,
I do have a check in my page for the user and it redirect users if they're logged in. I'm assume it's failing to check for the user
Have you pushed and generated the client?
@bekacru that worked! I feel so stupid now lol
thank you so much for your help!
My only feedback would be that a better error messages when schema/db doesn't match better auth's schema would be nice. Other than it has been awesome experience so far from api design, feature set, tooling, docs, to support
thanks and will definitely consider that!
Unknown User•5w ago
Message Not Public
Sign In & Join Server To View
can you share your prisma schema
Unknown User•5w ago
Message Not Public
Sign In & Join Server To View
basically the error is thrown from prisma not better auth. It happens cause when better auth tries to create a user (most likely) prisma is throwing error. First remove where you changed the model name to
User
. Email verified needs to be boolean field. and cross check or your remaining schema with what better auth expects in the docs.Unknown User•5w ago
Message Not Public
Sign In & Join Server To View
https://github.com/Chandraprakash-Darji/better-auth-test/blob/main/lib/auth.ts#L21-L27
remove this from your config
GitHub
better-auth-test/lib/auth.ts at main · Chandraprakash-Darji/better-...
Contribute to Chandraprakash-Darji/better-auth-test development by creating an account on GitHub.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
I think it's related to the admin plugin
try to signup without it
the problem is enums can't be set as strings in prisma
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
no it returns boolean. It might be releated to the object id. Disbale the default id by setting
advanced.generateId
to false
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View