Skip to content

fix(bootstrap): Handle failed org preload requests#120588

Open
scttcper wants to merge 2 commits into
masterfrom
scttcper/fix-spa-preload-errors
Open

fix(bootstrap): Handle failed org preload requests#120588
scttcper wants to merge 2 commits into
masterfrom
scttcper/fix-spa-preload-errors

Conversation

@scttcper

@scttcper scttcper commented Jul 24, 2026

Copy link
Copy Markdown
Member

Standalone SPA preload failures reject with an undefined tuple that gets reported as noisy frontend errors.

Resolve null at the source and remove the null-tuple SDK filter that was trying to hide these events.

Refs #109588
fixes JAVASCRIPT-2XH0

scttcper and others added 2 commits July 24, 2026 12:27
Standalone SPA preload failures reject with an undefined tuple that gets reported as noisy frontend errors.

Resolve null at the source and remove the null-tuple SDK filter that was trying to hide these events.

Refs #109588

Co-Authored-By: Codex <noreply@openai.com>
Match the global preload promise types to the null fallback used for failed requests.

Co-Authored-By: Codex <noreply@openai.com>
@scttcper
scttcper requested review from a team as code owners July 24, 2026 20:02
@scttcper
scttcper requested review from chargome, logaretm, msonnb and nicohrubec and removed request for a team July 24, 2026 20:02
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 24, 2026
@scttcper
scttcper requested a review from a team July 24, 2026 20:03
@scttcper

Copy link
Copy Markdown
Member Author

should be safe to roll out if either deploy first

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c95cdd0. Configure here.

beforeSend(event, hint) {
if (
isFilteredRequestErrorEvent(event) ||
isEventWithFileUrl(event) ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Filter removed too early

Medium Severity

Removing isNullTupleUnhandledRejectionEvent drops coverage for the Django preload-data.html path, which still rejects failed preloads as an undefined status tuple. Those early unhandled rejections can resurface as the same noisy frontend errors this change is trying to eliminate.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c95cdd0. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

its okay if it makes some noise while deploying

Comment on lines 185 to 191
},

beforeSend(event, hint) {
if (
isFilteredRequestErrorEvent(event) ||
isEventWithFileUrl(event) ||
isNullTupleUnhandledRejectionEvent(hint)
) {
if (isFilteredRequestErrorEvent(event) || isEventWithFileUrl(event)) {
return null;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Removing the isNullTupleUnhandledRejectionEvent filter without adding .catch() handlers to promises in preload-data.html will cause previously ignored unhandled promise rejections to be reported to Sentry.
Severity: MEDIUM

Suggested Fix

Update the preload-data.html template to attach a no-op .catch(() => {}) handler to the promises assigned to window.__sentry_preload. This will prevent them from becoming unhandled rejections if they fail before being consumed by the application's bootstrap logic, while still allowing the rejection to be properly handled by the consumer later.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/bootstrap/initializeSdk.tsx#L185-L191

Potential issue: The `preload-data.html` template creates promises for preloading data
and stores them on the `window` object. These promises, created via `promiseRequest()`,
can reject, especially on network errors. They lack a `.catch()` handler. While they are
eventually consumed and their rejections are caught within `bootstrapRequests.tsx`, a
race condition exists. If a promise rejects before it is consumed, it triggers an
unhandled promise rejection. The pull request removes the
`isNullTupleUnhandledRejectionEvent` filter, which previously discarded these specific
rejections. Consequently, these transient unhandled rejections will now be captured and
sent as events to Sentry.

Also affects:

  • static/app/bootstrap/index.tsx:67~75

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

its okay if it makes some noise while deploying

@scttcper scttcper changed the title fix(ui): Handle failed SPA preload requests fix(bootstrap): Handle failed SPA preload requests Jul 24, 2026
@scttcper scttcper changed the title fix(bootstrap): Handle failed SPA preload requests fix(bootstrap): Handle failed org preload requests Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants