New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get bookings via API returns 500 error #14735
Comments
Hey there, @pgvr! 👋 Fancy seeing you here again - hope this message finds you less bugged than your API key seems to be. 😅 I'm diving into your issue as we speak, and I'll circle back with a diagnostic spell shortly. 🧙♂️ |
|
To address the issue with the
Here's an example modification for better error handling in the async function handler(req: NextApiRequest) {
try {
// Your logic here...
const data = await prisma.booking.findMany(args);
return { bookings: data.map((booking) => schemaBookingReadPublic.parse(booking)) };
} catch (error) {
console.error("Error retrieving bookings:", error);
if (error instanceof RateLimitError) {
return res.status(429).json({ message: "Rate limit exceeded" });
}
throw new HttpError({ message: "An error occurred while retrieving bookings.", statusCode: 500 });
}
} This ensures exceptions are caught, and a JSON error response is returned, potentially resolving the issue with the HTML error response and improving the handling of rate limit errors.
|
Found a bug? Please fill out the sections below. 👍
Issue Summary
Get bookings via API returns 500 error.
This happens for a certain API key, that I can share with someone from Cal.com, if need be.
For new keys that I create this request works.
Actual Results
Expected Results
Evidence
The text was updated successfully, but these errors were encountered: