Skip to content

fix(preload): Prevent [null,null] unhandled rejections from preload-data.html - #122947

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/preload-null-rejection
Draft

fix(preload): Prevent [null,null] unhandled rejections from preload-data.html#122947
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/preload-null-rejection

Conversation

@sentry

@sentry sentry Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the escalating volume of [null,null] unhandled rejection events originating from the inline preload script in src/sentry/templates/sentry/partial/preload-data.html.

Problem:
The promiseRequest function within preload-data.html was designed to throw [response.status, response.statusText] for non-2xx responses and throw [error.status, error.statusText] for network failures. When a preload fetch received no response, error.status and error.statusText were undefined, leading to a rejection with [undefined, undefined], which the SDK normalized to [null,null] via onunhandledrejection.

Root Cause:
PR #120588 (merged 2026-07-24) fixed the sibling bundled copy (static/app/bootstrap/index.tsx) to return null in both error branches and, crucially, removed the isNullTupleUnhandledRejectionEvent beforeSend filter that previously suppressed these events. The preload-data.html template was never updated, so it continued to throw and, with the filter removed, these events began to be reported to Sentry.

Solution:
This change mirrors the fix implemented in PR #120588. The promiseRequest function in src/sentry/templates/sentry/partial/preload-data.html is updated to return null instead of throw in both the non-2xx response handling and the catch block. This ensures that failed preload requests are handled gracefully without generating unhandled rejections.

Impact:
The shared consumer getPreloadedData in static/app/bootstrap/bootstrapRequests.tsx already expects and handles null returns, 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.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants