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

Requests that executed shown in breadcrumbs without status

Open ant1m4tt3r opened this issue 1 year ago • 4 comments

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

Not sure how to reproduce, but requests made a few seconds before a page closes (around 20 seconds) repeatedly are showing as error in Issues panel without status, but when I check the associated Replay the requests have status on then and they're successful.

Expected Result

I would like to see the correct status of my requests and not an issue created.

Actual Result

Captura de Tela 2024-06-21 às 17 38 23

I could not capture a replay with all of the charges reported in the issue as status 0 on the replay for some reason, but as soon as I find an example where all of the repeated requests in replay show the status 200 I'll add more info here.

Product Area

Issues

Link

https://trinio.sentry.io/issues/5238705593/?project=4503965217849344&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=24h&stream_index=2&utc=true

DSN

https://28b65f5386004f04b47ea28eb9ec00d5@o4503961131286528.ingest.sentry.io/4503965217849344

Version

No response

ant1m4tt3r avatar Jun 21 '24 19:06 ant1m4tt3r

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] avatar Jun 21 '24 19:06 getsantry[bot]

Routing to @getsentry/product-owners-issues for triage ⏲️

getsantry[bot] avatar Jun 24 '24 17:06 getsantry[bot]

On the issues side, it looks like the breadcrumbs do explicitly have a value of 0 for the status_code so it isn't an issue of not reflecting the correct value in the UI. It seems the event itself did not assemble the breadcrumbs correctly and we're just displaying the error.

I'm going to transfer this issue to the Javascript SDK team as a best guess for who might be able to look into why the status_code is being set to 0 for your breadcrumbs.

leeandher avatar Jun 24 '24 19:06 leeandher

For reference, this is an occurrence where you can actually see this:

Issue: https://trinio.sentry.io/issues/5238552370/events/0d6faa48dd8c4d85a9f816e22a711d9c/?project=4503965217849344&referrer=replay-errors Replay: https://trinio.sentry.io/replays/fae058b729d64938922bee79d6accc84/?f_n_type=resource.xhr&n_detail_row=67&project=4503965217849344&query=&referrer=%2Freplays%2F&statsPeriod=14d&t_main=network&yAxis=count%28%29

BUT I think that there is another problem here really, because if you look closely you can see that the error happened at 09:01, while the last network item in the replay happened at 08:57. So the error happend after the replay has ended. So the erroring breadcrumb is not even reflected in the replay.

You can also see that all the 0 status requests happened at exactly the same time, which is 09:01:52. So I think it is likely that what is happening is something like, the browser goes into the background/idles, some requests are pending, when the user returns the requests are aborted. They are not yet reflected in the replay, because the replay breadcrumbs are created after the "core" ones are, and it's likely the page is unloaded before this is actually flushed.

So overall, I don't think there is anything wrong here - the requests are indeed aborted and have a status code 0, probably. It's just a bit misleading because there are other requests that appear similar in the replay that have a status code, but those are actually other requests (that are also correctly marked with statusCode 200 in the issue).

Are you using httpClientIntegration to catch these as issues, or is this being captured by some exception handler in your code? You could filter out these errors, network errors with statusCode 0 are probably not super helpful to you in this case.

For example, you could do this:

Sentry.init({
  beforeSend: (event) => {
    if (event.contexts?.AxiosError && !event.contexts.AxiosError.status) {
      return null;
    }
    return event;
  }
});

mydea avatar Jun 25 '24 07:06 mydea

thank you, this was very helpful! solved our problem!

ant1m4tt3r avatar Jul 09 '24 21:07 ant1m4tt3r