creation of new user failed and exited an error in vercel logs for my project
In the creation of new users I made use of better auth for authentication and the creation of a new user in my nextjs project which I integrated with prisma as my ORM with supabase as my database............. this arrangement however performs the creation of the new user in development however after deploying to vercel and performing the same authentication of new users it throws this error which indicates that the new user cannot be created and i don't seem to know why it doesn't work in deployment where i have added the environemt variables required by prisma like the DATABASE_URL and the DIRECT_URL needed by prisma to connect to my supabase database and this connnection worked fine
The error from vercel logs upon creation of new users:
[Better Auth] ERROR
Invalid prisma.user.findFirst() invocation: The table public.User does not exist in the current database. Invalid prisma.user.findFirst() invocation:
The table public.User does not exist in the current database. at $n.handleRequestError (node_modules/@prisma/client/runtime/library.js:121:7315) at $n.handleAndLogRequestError (node_modules/@prisma/client/runtime/library.js:121:6623) at $n.request (node_modules/@prisma/client/runtime/library.js:121:6307) at async l (node_modules/@prisma/client/runtime/library.js:130:9633) at async Object.findOne (.next/server/app/api/auth/[...all]/route.js:2689:39615) at async Object.findUserByEmail (.next/server/app/api/auth/[...all]/route.js:85:21632) at async .next/server/app/api/auth/[...all]/route.js:85:1052 at async i (.next/server/app/api/auth/[...all]/route.js:1:66010) at async s.<computed> (.next/server/app/api/auth/[...all]/route.js:85:6930) at async s (.next/server/app/api/auth/[...all]/route.js:1:70740) @everyone
Invalid prisma.user.findFirst() invocation: The table public.User does not exist in the current database. Invalid prisma.user.findFirst() invocation:
The table public.User does not exist in the current database. at $n.handleRequestError (node_modules/@prisma/client/runtime/library.js:121:7315) at $n.handleAndLogRequestError (node_modules/@prisma/client/runtime/library.js:121:6623) at $n.request (node_modules/@prisma/client/runtime/library.js:121:6307) at async l (node_modules/@prisma/client/runtime/library.js:130:9633) at async Object.findOne (.next/server/app/api/auth/[...all]/route.js:2689:39615) at async Object.findUserByEmail (.next/server/app/api/auth/[...all]/route.js:85:21632) at async .next/server/app/api/auth/[...all]/route.js:85:1052 at async i (.next/server/app/api/auth/[...all]/route.js:1:66010) at async s.<computed> (.next/server/app/api/auth/[...all]/route.js:85:6930) at async s (.next/server/app/api/auth/[...all]/route.js:1:70740) @everyone
6 Replies
@everyone
Hi @Collins
Did you run
npx prisma migrate deploy
in your production environment? This applies your Prisma migrations to create necessary tables.i added this line "vercel-build": "prisma generate && prisma migrate deploy && next build" to the scripts in my package.json which has prisma migrate deploy in it and should be executed when vercel builds the application or should i have vercel run it separately?
That's the correct procedure. You don't need to run it separately. Can you inspect your supabase database that the tables are created correctly?
okay let me give it a try
I implemeted it and i reset my database and ran prisma db push to reinitialze the schema and migrations present as i made them in my prisma schema............. but stiill anyime a new user is being created i still receive the same error 500 in my vercel logs meaning that the new user is not created and it didn't work but it works in development and i honestly don't know the cause of this issue or how i can resolve it
this is the log i am still receiving after making those changes you said i should try
[Better Auth] ERROR
Invalid prisma.user.findFirst() invocation: The table public.User does not exist in the current database. Invalid prisma.user.findFirst() invocation:
The table public.User does not exist in the current database. at $n.handleRequestError (node_modules/@prisma/client/runtime/library.js:121:7315) at $n.handleAndLogRequestError (node_modules/@prisma/client/runtime/library.js:121:6623) at $n.request (node_modules/@prisma/client/runtime/library.js:121:6307) at async l (node_modules/@prisma/client/runtime/library.js:130:9633) at async Object.findOne (.next/server/app/api/auth/[...all]/route.js:2689:39615) at async Object.findUserByEmail (.next/server/app/api/auth/[...all]/route.js:85:21632) at async .next/server/app/api/auth/[...all]/route.js:85:1052 at async i (.next/server/app/api/auth/[...all]/route.js:1:66010) at async s.<computed> (.next/server/app/api/auth/[...all]/route.js:85:6930) at async s (.next/server/app/api/auth/[...all]/route.js:1:70740) @everyone @RaphaelEtim
Invalid prisma.user.findFirst() invocation: The table public.User does not exist in the current database. Invalid prisma.user.findFirst() invocation:
The table public.User does not exist in the current database. at $n.handleRequestError (node_modules/@prisma/client/runtime/library.js:121:7315) at $n.handleAndLogRequestError (node_modules/@prisma/client/runtime/library.js:121:6623) at $n.request (node_modules/@prisma/client/runtime/library.js:121:6307) at async l (node_modules/@prisma/client/runtime/library.js:130:9633) at async Object.findOne (.next/server/app/api/auth/[...all]/route.js:2689:39615) at async Object.findUserByEmail (.next/server/app/api/auth/[...all]/route.js:85:21632) at async .next/server/app/api/auth/[...all]/route.js:85:1052 at async i (.next/server/app/api/auth/[...all]/route.js:1:66010) at async s.<computed> (.next/server/app/api/auth/[...all]/route.js:85:6930) at async s (.next/server/app/api/auth/[...all]/route.js:1:70740) @everyone @RaphaelEtim