Please share the client code which triggers the otp sending. And as well the logs of this
const storedOtp = await prisma.otp.findFirst({
where: { email, otp },
orderBy: { createdAt: "desc" },
});
// add debugging
console.log('OTP: ', otp)
console.log('storedOtp: ', storedOtp)
console.log('Email: ', email)
if (
!storedOtp ||
new Date() - new Date(storedOtp.createdAt) > 10 * 60 * 1000
) {
return res.status(400).json({ message: "Invalid or expired OTP" });
}