Skip to content

fix(replay): Capture aborted/errored fetch requests in replay network tab#20722

Open
nicohrubec wants to merge 1 commit intodevelopfrom
fix/replay-aborted-fetch-network-tab
Open

fix(replay): Capture aborted/errored fetch requests in replay network tab#20722
nicohrubec wants to merge 1 commit intodevelopfrom
fix/replay-aborted-fetch-network-tab

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented May 8, 2026

Fetch requests that are aborted or fail before receiving response headers never appear in the replay network tab. Reproducible by calling fetch() with an AbortController that fires before headers arrive. With this setup the request shows up in Sentry breadcrumbs (on the error objects) but is missing from the replay network tab.

_isFetchHint() gates on hint.response existing, but when a fetch errors or is aborted the breadcrumb handler in the breadcrumb integration creates a hint with the error as data and no response (since none was received). Changed the guard to check hint.input instead, which is always present.

Not sure if there was a specific reason to guard on the response here, in that case we can look into alternative solutions. With the current setup at least I get the request to show up in the replay network tab:
Screenshot 2026-05-08 at 13 04 16

Fixes #20714

… tab

Aborted or network-errored fetch requests were completely absent from
the replay network tab because `_isFetchHint()` required `hint.response`
to be present. The error path in the breadcrumb handler creates hints
without a `response` property, causing the guard to return false and
silently skip replay network capture.

Change the guard to check `hint.input` instead (the fetch args array),
which is present in both success and error breadcrumb hints. The
downstream functions (`enrichFetchBreadcrumb`, `captureFetchBreadcrumbToReplay`)
already accept `Partial<FetchHint>` and handle undefined `response`.

Fixes JS-2374

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec marked this pull request as ready for review May 8, 2026 11:06
@nicohrubec nicohrubec requested a review from a team as a code owner May 8, 2026 11:06
@nicohrubec nicohrubec requested a review from chargome May 8, 2026 11:15
Copy link
Copy Markdown
Member

@logaretm logaretm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dug into the history a bit. The response check seems to come from when this handler originally typed FetchHint as requiring a Response, so it looks like it was mostly a type/runtime-shape guard for the successful fetch path, not an intentional decision to exclude failed or aborted fetches.

Previous check also didn't return a boolean so this one should be actually better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming fetch API calls are completely absent from the network tab

2 participants