getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.98k stars 1.57k forks source link

Sentry reports handled errors in Fastify integration #13197

Open tmcw opened 3 months ago

tmcw commented 3 months ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

8.0.0

Framework Version

4.28.1

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

This has already been reported in #12055 but the auto-closer closed it and I can't reopen it, so I'm reporting it again.

Using Sentry.setupFastifyErrorHandler(app) for Fastify leads to Sentry reporting errors for issues that aren't issues: 400s for failed validation, 404s, etc, etc. Lots of errors, lots of noise, all of it not the kind of internal server errors that we want Sentry to track.

A good default might be what the immobiliare 3rd party Sentry plugin has been doing, which is to only track errors with status codes >= 500.

Expected Result

Sentry shouldn't track errors with status < 500 because they are expected.

Actual Result

it tracks all responses with status >= 400

AbhiPrasad commented 3 months ago

Opened https://github.com/getsentry/sentry-javascript/pull/13198 as a PR to address this!