We get a lot of "Network request failed" or similar errors from Users in Sentry which are not really valuable to use and crowd the view on real issues.
Most of the issues we see in Sentry are connected to network problems of users. Having these issues in Sentry does not really help us, and furthermore getting mail about such issues results in these mails not being taken so serious anymore. It would be helpful if we could configure Sentry (best directly the client library) to not send such errors to Sentry.
Example errors:
errorNetwork request failed
errorFailed to fetch
TypeErrorwhatwg-fetch/fetch in default
errorNetwork request failed
...and more
Have you tried using the beforesend hook to filter events your applications are sending?
Not yet, good suggestion.
Iām not sure what to filter though, because the network timeout error messages are even browser- and user OS language specific š¤¦āāļø (āDie Netzwerkverbindung wurde unterbrochen.ā
Iāll try it with that though, thanks! If you have any specific suggestions what makes sense to filter, fire away.
Hi @fabb, Did you have a solution for this? I'm facing the same problem, a bunch of error related to Network Request with the status code 0.0 logged on Sentry which are very annoying.
Not really a good one. It's possible to add a filter to Sentry.init:
Sentry.init({
ignoreErrors: ['Network request failed', 'Failed to fetch', 'NetworkError', 'withrealtime/messaging'],
....
})
But this will only filter a part, as localized browser send error messages in their language.
Thanks a lot @fabb, I will try it
@fabb and @nenjamin2405 - did either of you get further on this?
Is ignoreErrors the best solution at the moment? Will that work when the message is something like Network error: NetvƦrksforbindelsen gik tabt. or do I need to use regex?
@Cyberlane that should work as we do an .indexOf() check with string values here: https://github.com/getsentry/sentry-javascript/blob/c1b559d631429d8d41af499abdcd860218e1b209/packages/utils/src/string.ts#L91-L99
(you can still use a RegExp for a more complex filter)
@fabb - do you think we can close this issue?
Itās too bad that there is no generic solution (independent of user browser language). Unless I have overlooked some other way to identify these errors, I guess this ticket can be closed.
Itās too bad that there is no generic solution (independent of user browser language).
That's the cost we all pay for not standardizing error messages using codes in EcmaScript spec š¦
Closing as you suggested @fabb but feel free to comment here if you ever find a better way.
@fabb how are you capturing "network error" issues and sending it to Sentry? It fails when I run captureexception when there is no internet connection on a device.
I guess such errors will be dropped unless sentry supports writing them to local storage and sending them later. I have to admit that I donāt really care about such errors.
@fabb I agree but even to send an error like Sentry.captureException(new Error('test')) would fail when there is no internet connection and crashes the app. Does it not crash the app for you? It throws like a bunch of React Native errors for me.
I donāt use React Native, but React DOM, never noticed such a crash there.
@fabb Did you get other solution on how we can ignore Network error at Sentry?
I agree but even to send an error like Sentry.captureException(new Error('test')) would fail when there is no internet connection and crashes the app.
At least in the browser the errors seem to be batched and send later, otherwise they would never show up in Sentry.
Most helpful comment
Not really a good one. It's possible to add a filter to
Sentry.init:But this will only filter a part, as localized browser send error messages in their language.