Skip to content

Always attach some URL/target data point to fetch/xhr/request errors #13168

Open

Description

@lforst

Description

The Sentry Chief Product Officer has brought to our attention that Fetch errors sometimes suck. (example that will expire in 90 days)

Image

We technically have a stack trace here but sourcemaps are broken so the user has basically no idea what fetch request failed. It's very hard to gauge from breadcrumbs what exact request failed.

Side note, the fetch call that failed looked like fetch(""). We render this as in the product, you guessed it "". Which is crap because it actually means the request went to the current route. We should at least coerce that string to URL(fetchTarget, window.location.href).toString() in the SDK.

Image

Activity

  1. kunal649 commented on Oct 20, 2026

    @kunal649
  2. 3 remaining items

  3. lforst commented on Oct 20, 2026

    @lforst
    ContributorAuthor

    big

  4. self-assigned this
    on Oct 20, 2026
  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Oct 20, 2026
  6. kunal649 commented on Oct 28, 2026

    @kunal649
    Contributor

    Found 1 more spot , i think xhr.open('GET', '') is never instrumented, because the check in xhr.ts is !url, which treats an empty string like an unparseable argument. fetch('') does get a breadcrumb and span.

    if (!method || !url) {
    return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray);
    }

    Should i open a small PR that only bails when the URL can't be parsed (url === undefined)? - @s1gr1d wdyt should empty-URL XHRs stay uninstrumented?

  7. s1gr1d commented on Nov 6, 2026

    @s1gr1d
    Member

    Good find, yes please! fetch('') is already instrumented, so XHR should match and bailing only on url === undefined sounds correct.

    Can you also handle the breadcrumb URL in the same PR (your question from the first comment, now hidden)? Once xhr.open('GET', '') is instrumented, its breadcrumb would show "" too (same as fetch).

    When we resolve the url with location.href (like your PR #25784 does) and then stripping query and fragment (stripUrlQueryAndFragment in core) we can get the path without leaking params into breadcrumbs.

  8. kunal649 commented on Nov 7, 2026

    @kunal649
    Contributor

    opened a PR with both changes, take a look when you get a chance.

  9. kunal649 commented on Nov 12, 2026

    @kunal649
    Contributor

    Can it be closed now?

  10. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions