NextAuth v5 NEXT_REDIRECT error
Unanswered
Rhinelander posted this in #help-forum
RhinelanderOP
...
const registerUser = async (
formData: z.infer<typeof registerSchema>,
) => {
try {
const validatedData = registerSchema.parse(formData);
console.log("Parsed form data");
console.log(formData);
const user = await prisma.user.findUnique({
where: {
email: formData.email,
},
});
if (user) {
console.log("User already exists");
return {
success: false,
message: "User already exists",
};
} else {
await prisma.user.create({
data: {
firstName: validatedData.firstName,
lastName: validatedData.lastName,
email: validatedData.email,
role: "ADMIN",
},
});
console.log("Created new user");
}
await signIn("resend", formData);
console.log("Login link was sent");
return {
success: true,
message: "User registered successfully",
};
} catch (error) {
...
}This is the code that causes all the erors:
await signIn("resend", formData)First I get NEXT_REDIRECT error, than this [auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror
[auth][cause]: PrismaClientKnownRequestError:
Invalid
prisma.session.delete() invocation:An operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.2 Replies
RhinelanderOP
I get send link to login on my mail but when I click it it redirects to /api/auth/error?error=Configuration
Prisma schema is almost the same as default one i removed name and added first name, last name and role. Everything else is the same. My domain is verified my api key is name the same way as in the docs.