fix(preload): Prevent [null,null] unhandled rejections from preload-data.html - #122947
Draft
sentry[bot] wants to merge 1 commit into
Draft
fix(preload): Prevent [null,null] unhandled rejections from preload-data.html#122947sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR addresses the escalating volume of
[null,null]unhandled rejection events originating from the inline preload script insrc/sentry/templates/sentry/partial/preload-data.html.Problem:
The
promiseRequestfunction withinpreload-data.htmlwas designed tothrow [response.status, response.statusText]for non-2xx responses andthrow [error.status, error.statusText]for network failures. When a preload fetch received no response,error.statusanderror.statusTextwereundefined, leading to a rejection with[undefined, undefined], which the SDK normalized to[null,null]viaonunhandledrejection.Root Cause:
PR #120588 (merged 2026-07-24) fixed the sibling bundled copy (
static/app/bootstrap/index.tsx) toreturn nullin both error branches and, crucially, removed theisNullTupleUnhandledRejectionEventbeforeSendfilter that previously suppressed these events. Thepreload-data.htmltemplate was never updated, so it continued tothrowand, with the filter removed, these events began to be reported to Sentry.Solution:
This change mirrors the fix implemented in PR #120588. The
promiseRequestfunction insrc/sentry/templates/sentry/partial/preload-data.htmlis updated toreturn nullinstead ofthrowin both the non-2xx response handling and thecatchblock. This ensures that failed preload requests are handled gracefully without generating unhandled rejections.Impact:
The shared consumer
getPreloadedDatainstatic/app/bootstrap/bootstrapRequests.tsxalready expects and handlesnullreturns, falling back to a normal fetch. This change has a low blast radius, aligns the template's behavior with the bundled code, and eliminates the source of these unhandled rejection events.Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Fixes JAVASCRIPT-2XH0
Comment
@sentry <feedback>on this PR to have Autofix iterate on the changes.This PR was automatically generated by Sentry. You can adjust this setting at any time.