Skip to content

Commit

Permalink
fix: don't report invalid format-errors input (#4911)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbot authored Feb 5, 2024
1 parent 5ef5606 commit a343cdd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/format-errors/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,16 @@ export default {
},
},
});

// Validate payload outside of Sentry/metrics reporting
let payload: Payload;
try {
payload = PayloadSchema.parse(await request.json());
} catch {
return new Response("Invalid payload", { status: 400 });
}

try {
const payload = PayloadSchema.parse(await request.json());
return handlePrettyErrorRequest(payload);
} catch (e) {
sentry.captureException(e);
Expand Down

0 comments on commit a343cdd

Please sign in to comment.