The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Handle potential JSON parsing errors in Axiom body logging (#3100)
Kiran K499ce6599976
diff --git a/apps/web/lib/axiom/server.ts b/apps/web/lib/axiom/server.tsindex 69a916a671..520a3fd979 100644--- a/apps/web/lib/axiom/server.ts+++ b/apps/web/lib/axiom/server.ts@@ -44,7 +44,12 @@ export const withAxiomBodyLog = createAxiomRouteHandler(logger, {// Add body to report if the method is POST, PATCH, or PUTif (["POST", "PATCH", "PUT"].includes(data.req.method)) {- report.body = await data.req.json();+ try {+ report.body = await data.req.json();+ } catch (error) {+ // Body might be empty, invalid JSON+ // Silently skip adding body to report+ }}// Add search params to report