Save failed: user with the same identity already exists -- Making a user manually
I'm not sure how Wasp makes a user how does that work? I need to make a user in the background. If I write
if (!user) { // Create a new user if they don't exist user = await context.entities.User.create({ data: { email: invitation.invitedUserEmail, firstName, lastName, }, }); } else { // Update existing user user = await context.entities.User.update({ where: { id: user.id }, data: { firstName, lastName }, }); } return user;
if (!user) { // Create a new user if they don't exist user = await context.entities.User.create({ data: { email: invitation.invitedUserEmail, firstName, lastName, }, }); } else { // Update existing user user = await context.entities.User.update({ where: { id: user.id }, data: { firstName, lastName }, }); } return user;
The user exists in the backend but if they try to login/signup they receive the error Save failed: user with the same identity already exists
How can I create a user in the background and if they want to sign in they'll have to set a new password (Basically go through the signup again) I think I can figure out this part and it's not WASP specific just the creation of a user I don't fully understand.
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
W
Wasp
Rails-like framework for React, Node.js and Prisma. Build your app in a day and deploy it with a single CLI command.