feat(browser): Use fetch keepalive
flag
#5697
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on #5676 I noticed some navigation transactions don't show up in Sentry. I found out that when navigating between pages, Chrome cancels any outgoing requests - including requests to Sentry.
Events not being sent because of a page navigation probably happens the most with navigation transactions, since we usually finish the transaction right before we navigate (finishing happens implicitly on navigation). To requests being cancelled, we can use
fetch
'skeepalive
flag to keep outgoing requests alive, even when we're switching pages.#2547 has an excellent writeup on the pros and cons of this flag. In short:
keepalive
isn't supported by Firefoxkeepalive: true
and a content length of > 64 kibibytes returns a network errorThis change definitely isn't a solution to solve this problem in 100% of the cases but it is our best effort to improve the status quo.
Resolves #2547