Skip to content

Conversation

@evanpurkhiser
Copy link
Member

The project and organization monitor environment detail endpoint URL
patterns were missing trailing slashes, causing 404 responses when
requests included trailing slashes. This resulted in CORS preflight
failures as only the OPTIONS method was reported as allowed.

Fixed both URL patterns to accept trailing slashes:

The project and organization monitor environment detail endpoint URL
patterns were missing trailing slashes, causing 404 responses when
requests included trailing slashes. This resulted in CORS preflight
failures as only the OPTIONS method was reported as allowed.

Fixed both URL patterns to accept trailing slashes:
- sentry-api-0-project-monitor-environment-details
- sentry-api-0-organization-monitor-environment-details
@evanpurkhiser evanpurkhiser requested a review from a team as a code owner November 17, 2025 20:15
@evanpurkhiser evanpurkhiser requested review from a team and removed request for a team November 17, 2025 20:15
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) November 17, 2025 20:16
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 17, 2025
),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/monitors/(?P<monitor_id_or_slug>[^/]+)/environments/(?P<environment>[^/]+)$",
r"^(?P<organization_id_or_slug>[^/]+)/monitors/(?P<monitor_id_or_slug>[^/]+)/environments/(?P<environment>[^/]+)/$",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: URL Pattern: Trailing Slash Breaks Backward Compatibility

The URL pattern now requires a trailing slash instead of making it optional, breaking backward compatibility. Requests without trailing slashes (e.g., /monitors/abc/environments/prod) will no longer match. The pattern should use /?$ instead of /$ to accept both formats.

Fix in Cursor Fix in Web

),
re_path(
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/monitors/(?P<monitor_id_or_slug>[^/]+)/environments/(?P<environment>[^/]+)$",
r"^(?P<organization_id_or_slug>[^/]+)/(?P<project_id_or_slug>[^/]+)/monitors/(?P<monitor_id_or_slug>[^/]+)/environments/(?P<environment>[^/]+)/$",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Trailing Slash Breaks URL Routing

The URL pattern now requires a trailing slash instead of making it optional, breaking backward compatibility. Requests without trailing slashes (e.g., /monitors/abc/environments/prod) will no longer match. The pattern should use /?$ instead of /$ to accept both formats.

Fix in Cursor Fix in Web

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 17, 2025
@github-actions
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@evanpurkhiser evanpurkhiser merged commit 7b65f0f into master Nov 18, 2025
65 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/fix-crons-add-trailing-slash-to-monitor-environment-detail-endpoints branch November 18, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants