fix(bootstrap): Handle failed org preload requests#120588
Conversation
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>
|
should be safe to roll out if either deploy first |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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) || |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit c95cdd0. Configure here.
There was a problem hiding this comment.
its okay if it makes some noise while deploying
| }, | ||
|
|
||
| beforeSend(event, hint) { | ||
| if ( | ||
| isFilteredRequestErrorEvent(event) || | ||
| isEventWithFileUrl(event) || | ||
| isNullTupleUnhandledRejectionEvent(hint) | ||
| ) { | ||
| if (isFilteredRequestErrorEvent(event) || isEventWithFileUrl(event)) { | ||
| return null; | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
its okay if it makes some noise while deploying


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