Hello đź‘‹
It looks like the issue happens because you are not returning any response from your handler.
Can you try something like this?
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
export default async function handler(req, res) {
const { key } = req.query;
try {
const validation = await prisma.Reservation.findUnique({
where: {
id: key,
},
});
console.log(validation);
if (validation) {
res.status(200).json({ validation }); // send the validation as the response
} else {
res.status(404).json({ error: "No reservation found with this key." });
}
} catch (err) {
res.status(500).json({ error: err });
}
}