Skip to content

fix(discover): Prevent TypeError when decoding null fields from URL - #121035

Merged
natemoo-re merged 2 commits into
masterfrom
seer/fix/discover-null-field-match-error
Aug 5, 2026
Merged

fix(discover): Prevent TypeError when decoding null fields from URL#121035
natemoo-re merged 2 commits into
masterfrom
seer/fix/discover-null-field-match-error

Conversation

@sentry

@sentry sentry Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: Cannot read properties of null (reading 'match') that occurred when malformed URL query parameters for fields were present, specifically when an empty field parameter was included (e.g., &field=title&field).

Root Cause:
decodeFields in static/app/utils/discover/eventView.tsx uses decodeList to parse URL query parameters. When a query string like &field=title&field is encountered, decodeList can return an array containing null elements (e.g., ['title', null]). decodeFields then processed these null elements without validation, passing them downstream. Eventually, these null values reached functions like parseFunction in static/app/utils/discover/fields.tsx, which expected a string and attempted to call .match() on null, leading to the TypeError.

Solution:
An if (!field) return; guard has been added within the forEach loop in decodeFields. This ensures that any null or falsy field entries returned by decodeList are filtered out before being added to the parsed array. This prevents null values from propagating to downstream functions that expect string inputs, thereby resolving 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-3AQT

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 Aug 1, 2026
@natemoo-re natemoo-re added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Aug 5, 2026
@natemoo-re
natemoo-re marked this pull request as ready for review August 5, 2026 17:20
@natemoo-re
natemoo-re requested a review from a team as a code owner August 5, 2026 17:20
@natemoo-re
natemoo-re enabled auto-merge (squash) August 5, 2026 17:20
@natemoo-re
natemoo-re merged commit 62a4068 into master Aug 5, 2026
78 of 92 checks passed
@natemoo-re
natemoo-re deleted the seer/fix/discover-null-field-match-error branch August 5, 2026 17:25
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 Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant