baptisteArno / typebot.io

💬 Typebot is a powerful chatbot builder that you can self-host.

Home Page:https://typebot.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot login on previously created accounts after migrating installation

pedrofnts opened this issue · comments

I've migrated my Typebot installation to a new VPS. Initially, everything was functioning smoothly: all accounts were accessible (since sessions were preserved in the browser), and all bots were operational.

However, an issue arose when I had to log out of my account. Now, I am unable to log back in. Although I receive the email with the magic link, attempting to log in results in the error message "Try signing in with a different account."

Captura de Tela 2024-05-13 às 10 32 33

In the container logs, I noticed that Prisma attempts to create a new account using this email, despite it already existing in the database (since this user was previously registered).

Here are the pertinent log entries:

prisma:info Starting a postgresql pool with 5 connections. prisma:error Invalid prisma.user.create() invocation: Unique constraint failed on the fields: (email) [next-auth][error][adapter_error_createUser] https://next-auth.js.org/errors#adapter_error_createuser Invalid prisma.user.create() invocation: Unique constraint failed on the fields: (email) { message: '\n' + 'Invalid prisma.user.create() invocation:\n' + '\n' + '\n' + 'Unique constraint failed on the fields: (email)', stack: 'PrismaClientKnownRequestError: \n' + 'Invalid prisma.user.create() invocation:\n' + '\n' + '\n' + 'Unique constraint failed on the fields: (email)\n' + ' at In.handleRequestError (/app/node_modules/.pnpm/@prisma+client@5.12.1_prisma@5.12.1/node_modules/@prisma/client/runtime/library.js:122:6854)\n' + ' at In.handleAndLogRequestError (/app/node_modules/.pnpm/@prisma+client@5.12.1_prisma@5.12.1/node_modules/@prisma/client/runtime/library.js:122:6188)\n' + ' at In.request (/app/node_modules/.pnpm/@prisma+client@5.12.1_prisma@5.12.1/node_modules/@prisma/client/runtime/library.js:122:5896)\n' + ' at async l (/app/node_modules/.pnpm/@prisma+client@5.12.1_prisma@5.12.1/node_modules/@prisma/client/runtime/library.js:127:11167)\n' + ' at async createUser (/app/apps/builder/.next/server/chunks/524.js:1:672)', name: 'PrismaClientKnownRequestError' }

New accounts are able to log in without issues; the problem only occurs with accounts that were created prior to the migration.

So it seems it tries to create the user even though a user with that email already exists.

I'm a bit clueless 🤔 I don't know why it happens