Skip to content

fix(issues): Prevent TypeError from undefined spans in performance evidence - #123099

Draft
sentry[bot] wants to merge 3 commits into
masterfrom
seer/fix/filter-missing-spans
Draft

fix(issues): Prevent TypeError from undefined spans in performance evidence#123099
sentry[bot] wants to merge 3 commits into
masterfrom
seer/fix/filter-missing-spans

Conversation

@sentry

@sentry sentry Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: Cannot read properties of undefined (reading 'op') that occurs when rendering performance issue evidence on the issue details page.

Root Cause:
The getSpanInfoFromTransactionEvent function in static/app/components/events/interfaces/performance/utils.tsx constructs offendingSpans and causeSpans arrays by mapping offenderSpanIds and causeSpanIds to actual span objects. If an ID in offenderSpanIds or causeSpanIds does not correspond to an existing span in the event's EntrySpans (e.g., due to trimming or missing data), the spansById lookup returns undefined. These undefined values were then included in the offendingSpans and causeSpans arrays.

Downstream components, such as NPlusOneDBQueriesSpanEvidence, would then attempt to access properties like span.op on these undefined elements, leading to the TypeError.

Solution:
The getSpanInfoFromTransactionEvent function has been modified to chain .filter(Boolean) after the .map() operations for both offendingSpans and causeSpans. This ensures that any undefined entries resulting from missing span IDs are explicitly removed from the arrays before they are returned, preventing the TypeError in consuming components.

Fixes JAVASCRIPT-3BN2

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-3BN2

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 29, 2026
@sentry sentry Bot changed the title fix(issues): Prevent TypeError when rendering span evidence fix(issues): Prevent TypeError from undefined spans in performance evidence Aug 29, 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.

0 participants