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](https://private-user-images.githubusercontent.com/63073772/330075569-438151f3-1e12-4941-ab77-9300d23ac0c3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MzAzNjQsIm5iZiI6MTcyMTQzMDA2NCwicGF0aCI6Ii82MzA3Mzc3Mi8zMzAwNzU1NjktNDM4MTUxZjMtMWUxMi00OTQxLWFiNzctOTMwMGQyM2FjMGMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE5VDIzMDEwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThiNTkyMjA0ZmM5OWI5NDVlZmNiOTQ3YTI4MGFjZDBiZTkwZTAxMTk4ZTk2NGQ4YzgyZDNmYTJlNjRmZjgxMzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Cb4CKu8tp9E04C6feB35qt71GmG6eQxuQCLtQeSEbPI)
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