Error FAILED_TO_CREATE_USER with code 42703 when trying to create a new user
I've set up BetterAuth with my React and Vite app, and have tried to set it up with NestJS on the backend
I've gotten it to not throw errors on startup, however, when I run
I won't share EVERYTHING as i dont have enough characters, so if anyone is willing to help, let me know what you need, i.e my user entity, my nestjs setup etc, and I'll send it asap
Solution:Jump to solution
I had a password row in my table and didnt realize I shouldnt. wasted 10h figuriing that out
16 Replies
Did you receive any other errors on your server?
via my NestJS logs, no

i took the code off of https://github.com/laakal/nestjs-better-auth-template
GitHub
GitHub - laakal/nestjs-better-auth-template: This project demonstra...
This project demonstrates how to integrate Better Auth into a NestJS application - laakal/nestjs-better-auth-template
I also replaced the Mongo integration with Neon DB
I tried to basically copy the schema https://www.better-auth.com/docs/concepts/database#user
Database | Better Auth
Learn how to use a database with Better Auth.
and ofc i have some of my own stuff
altho i havent added an accounts table or a session table
not sure if i need to do that or if it does it itself
You should just run the better auth schema generation if possible.
iis it possible to run it so it generates an entity for nest though?
oh wait it generates a Kyseley sql fiile which i assume i can just use as a migration
Yeah
lemme see if thatll work
oh wait it needs an auth.ts file or a config file which nestjs doesnt have
You can just make a fake one with the same configurations as your apps.
I still get the same error :shrug:

oh wait nhvm im beiing dumb
so now, when i run something like
the password is set to null and its trying to push it
Failing row contains (gXZB6hU29dYk8aamkdMCP6avCbvElEfG, Test, [email protected], f, null, null, 2025-05-04 13:35:01.657+00, 2025-05-04 13:35:01.657+00).
id, name, email, emailVerified (i assume f means false), password, image, createdAt, updatedAt
so for some reason when running signUp.email, password is null
bump
so my users table matches the schema from https://www.better-auth.com/docs/concepts/database#user
my nestjs setup is the exact same as the github repo i linked above
oh my god i figured it out
oh my
god
i hate my life
Solution
I had a password row in my table and didnt realize I shouldnt. wasted 10h figuriing that out