Next.js auth with Resend - Error
Unanswered
Rhinelander posted this in #help-forum
RhinelanderOP
My resend signin function:
I use zod - typical form setup. This is my submit function. Login function just makes sure that person is registered already...
I get an email but when i open it there is an error with configuration. My configuration is same as in the docs (nextauth v5) - it worked like 5h ago, it randomly stopped i even have debuger and error is
Schema is same as in docs with added couple of things
...
async function sendLoginLink(email: string) {
try {
await signIn("resend", { email, redirect: false });
return { success: true, message: "Login link sent successfully" };
} catch (error) {
console.error("Error sending login link:", error);
return { success: false, message: "Failed to send login link" };
}
}
...I use zod - typical form setup. This is my submit function. Login function just makes sure that person is registered already...
async function onSubmit(formData: z.infer<typeof loginSchema>) {
const login = await loginUser(formData);
if (login.success) {
const loginLink = await sendLoginLink(formData.email);
if (loginLink.success) {
router.push("/check-email");
} else {
setError(loginLink.message);
}
} else {
setError(login.message);
}
setTimeout(() => {
setError("");
}, 5000);
}I get an email but when i open it there is an error with configuration. My configuration is same as in the docs (nextauth v5) - it worked like 5h ago, it randomly stopped i even have debuger and error is
[auth][details]: {}
[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.Schema is same as in docs with added couple of things