sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Fetch errors provide very little info

Open rchl opened this issue 4 years ago • 5 comments

  • [x] Review the documentation: https://docs.sentry.io/
  • [x] Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
  • [x] Use the latest release: https://github.com/getsentry/sentry-javascript/releases
  • [ ] Provide a link to the affected event from your Sentry account

Package + Version

  • [x] @sentry/browser
  • [ ] @sentry/node
  • [ ] raven-js
  • [ ] raven-node (raven for node)
  • [ ] other:

Version:

6.14.1

Description

When there is a failure to make a fetch request, the errors reported have no information that would allow me to know what request was attempted. The breadcrumb integration saves the day a little bit because I can look for errors in it but it's not solving the issue 100% since with lazy loading the breadcrumbs might be missing.

Would it be possible to provide more information in cases when fetch requests fail?

A typical event for those kind of errors is a TypeError: failed to fetch exception, for example, with an exception message that can differ per browser and even locale so it's hard to ignore it just based on that.

Screenshot 2021-11-11 at 15 51 48

I believe that Sentry wraps the fetch API so I think it is in a position to provide more information in that case.

To clarify, I'm talking about when request has failed to be dispatched, not when the request finishes with an error code (that doesn't report a Sentry event normally). So for example when the URL is blocked through the Developer tools "block url" functionality (easy to test with).

rchl avatar Nov 11 '21 14:11 rchl

Thanks for raising an issue. We agree that failed to fetch errors could be better. I'm backlogging this for the team, but in the mean time, contributions and PRs to address this are welcome!

AbhiPrasad avatar Nov 11 '21 17:11 AbhiPrasad

Having the same pb as on May 2022. Any news on this issue ?

SofienM avatar May 20 '22 14:05 SofienM

ditto

TheDuckGoesQuark avatar Jul 18 '22 12:07 TheDuckGoesQuark

Hey folks. We’ve started to take a look at this. Could you please leave feedback in https://github.com/getsentry/sentry-javascript/discussions/5334?

In particular we would like feedback about what you would expect in this error. What kind of information would help debug this better?

AbhiPrasad avatar Jul 18 '22 14:07 AbhiPrasad

For me, any information about why it failed to fetch--the server error code, or if it's CORS-related, for example. thank you!

frnsys avatar Jul 26 '22 13:07 frnsys

Same here... I'd like to improve the logged info or skip these errors from being logged, as they fill our errors/transactions quota

JavierMartinz avatar Nov 24 '22 08:11 JavierMartinz

Any informattion regarding the failed request or even the status code might be helpful in my case

s-ashwin avatar Feb 14 '23 04:02 s-ashwin

@s-ashwin We recently added the HttpClient integration that should collect that stuff and report it. It's currently not part of the default integrations so you have to add it manually.

lforst avatar Feb 14 '23 09:02 lforst

As a matter of cleaning up issues, I am closing this as this can be done with the HttpClient integration now.

mydea avatar Jul 26 '23 09:07 mydea