Skip to content

fix(span-evidence): Prevent TypeError from nullish spans in NPlusOneDBQueriesSpanEvidence - #120703

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/span-evidence-null-spans
Draft

fix(span-evidence): Prevent TypeError from nullish spans in NPlusOneDBQueriesSpanEvidence#120703
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/span-evidence-null-spans

Conversation

@sentry

@sentry sentry Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The NPlusOneDBQueriesSpanEvidence component was encountering a TypeError: undefined is not an object (evaluating 'e.op').

This occurred because the offendingSpans array, which is derived from evidenceData mapping to event spans, could contain null or undefined elements. This happens when evidenceData references span IDs that are no longer present in the event's full span list (e.g., due to trimming or partial payloads).

The existing guard (span.op || '') only protected against a missing op property on a valid span object, but not against span itself being null or undefined.

This fix introduces an upfront filter(Boolean) on offendingSpans to create validSpans. All subsequent operations that access span properties now use validSpans, ensuring that only valid span objects are processed and preventing the TypeError.

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

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 27, 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