Skip to content

Commit

Permalink
fix sentry fastify error reporting (#101)
Browse files Browse the repository at this point in the history
Co-authored-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
juliangruber and bajtos authored Jan 28, 2025
1 parent 3fed846 commit 1b97e24
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion api/lib/instrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,16 @@ Sentry.init({
dsn: 'https://[email protected]/4508002559393792',
release: pkg.version,
environment: SENTRY_ENVIRONMENT,
tracesSampleRate: 0.1
tracesSampleRate: 0.1,
// Ignore Fastify 4xx errors
// Remove once https://github.com/getsentry/sentry-javascript/pull/13198 lands
beforeSend (event, { originalException: err }) {
const isBadRequest =
typeof err === 'object' &&
err !== null &&
'statusCode' in err &&
typeof err.statusCode === 'number' &&
err.statusCode < 500
return isBadRequest ? null : event
}
})

0 comments on commit 1b97e24

Please sign in to comment.