Skip to content

fix(detectors): Guard against null queryObj in cron monitor list#119445

Closed
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/cron-monitor-queryobj-null
Closed

fix(detectors): Guard against null queryObj in cron monitor list#119445
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/cron-monitor-queryobj-null

Conversation

@sentry

@sentry sentry Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a TypeError: Cannot read properties of null (reading 'environments') that occurred in the cron monitor list (/monitors/crons/).

The root cause was that the API could return a CronDetector object where dataSources[0].queryObj was null, even though the TypeScript type CronMonitorDataSource declared queryObj as non-nullable. This led to a runtime crash when accessing properties like environments on a null queryObj.

The fix involves:

  1. Updating the CronMonitorDataSource type in static/app/types/workflowEngine/detectors.tsx to correctly reflect that queryObj can be null.
  2. Adding optional chaining (?.) and null guards in static/app/views/detectors/list/cron.tsx for all accesses to queryObj and its properties, specifically in the VisualizationCell and the environment-label column's renderCell function. This ensures the UI gracefully handles cases where queryObj is null without crashing.

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-39QF

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

@sentry sentry Bot requested a review from a team as a code owner July 10, 2026 22:39
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.93% 93.93% ±0%
Typed 134,713 134,714 🟢 +1
Untyped 8,704 8,705 🔴 +1
🔍 1 new type safety issue introduced

Non-null assertions (!) (1 new)

File Line Detail
static/app/views/detectors/list/cron.tsx 88 cronId!

This is informational only and does not block the PR.

@malwilley

Copy link
Copy Markdown
Member

This is more of a data integrity issue, so it's better that we delete the offending models and prevent the data from being corrupted instead. Making this an optional field isn't really correct and it will cause the code to be much more gnarly

@malwilley malwilley closed this Jul 10, 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.

1 participant