Skip to content

fix(discover): Prevent 404 for disabled homepage feature#113494

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/discover-homepage-404
Draft

fix(discover): Prevent 404 for disabled homepage feature#113494
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/discover-homepage-404

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented Apr 20, 2026

This PR addresses the "Failed HTTP Operation" issue (JAVASCRIPT-384Z) occurring on /explore/discover/homepage/.

Root Cause:
The backend endpoint GET /api/0/organizations/{org}/discover/homepage/ was returning an HTTP 404 Not Found status when the requesting organization did not have either the organizations:discover or organizations:discover-query feature flags enabled. The frontend, however, was only checking for organizations:discover-query before making the API call. This mismatch, combined with the backend's 404 response for a feature-gated endpoint, led to Sentry's performance monitoring flagging it as a "Failed HTTP Operation."

Changes Made:

  1. Backend (src/sentry/discover/endpoints/discover_homepage_query.py): Modified the get, put, and delete methods of DiscoverHomepageQueryEndpoint to return HTTP_204_NO_CONTENT instead of HTTP_404_NOT_FOUND when the required feature flags (organizations:discover or organizations:discover-query) are not present. This aligns the behavior with the case where no saved homepage query exists, which is a non-error state the frontend can handle gracefully.
  2. Frontend (static/app/views/discover/homepage.tsx): Updated the enabled condition for the useApiQuery hook to check for both organization.features.includes('discover-query') OR organization.features.includes('discover'). This ensures the frontend only attempts to fetch the homepage query if the organization has any of the necessary Discover feature flags enabled, preventing unnecessary API calls that would result in a 204 response.

Impact:
These changes eliminate the erroneous 404 responses, preventing the

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-384Z

@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Apr 20, 2026
@github-actions
Copy link
Copy Markdown
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.

@getsantry
Copy link
Copy Markdown
Contributor

getsantry Bot commented May 12, 2026

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry Bot added the Stale label May 12, 2026
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 Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant