fix(discover): Prevent 404 for disabled homepage feature#113494
fix(discover): Prevent 404 for disabled homepage feature#113494sentry[bot] wants to merge 1 commit into
Conversation
|
🚨 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 |
|
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 "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
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 theorganizations:discoverororganizations:discover-queryfeature flags enabled. The frontend, however, was only checking fororganizations:discover-querybefore 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:
src/sentry/discover/endpoints/discover_homepage_query.py): Modified theget,put, anddeletemethods ofDiscoverHomepageQueryEndpointto returnHTTP_204_NO_CONTENTinstead ofHTTP_404_NOT_FOUNDwhen the required feature flags (organizations:discoverororganizations: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.static/app/views/discover/homepage.tsx): Updated theenabledcondition for theuseApiQueryhook to check for bothorganization.features.includes('discover-query')ORorganization.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