:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(settings): handle errors in authorized URL suggestions loader (#87381)
posthog[bot]e2dc854a0504
diff --git a/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.test.ts b/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.test.tsindex 7636c77dd58f..047352d26587 100644--- a/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.test.ts+++ b/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.test.ts@@ -120,6 +120,28 @@ describe('the authorized urls list logic', () => {})})+ describe('loading suggestions', () => {+ // Regression coverage: suggestions are advisory, so a failed query must leave the list empty+ // and succeed the loader rather than escape as an unhandled kea-loaders error into error tracking.+ it('returns no suggestions when the query fails', async () => {+ useMocks({+ post: {+ '/api/environments/:team_id/query/:kind': [+ 500,+ { type: 'server_error', detail: 'error from the API' },+ ],+ },+ })++ await expectLogic(logic, () => {+ logic.actions.loadSuggestions()+ })+ .toDispatchActions(['loadSuggestions', 'loadSuggestionsSuccess'])+ .toNotHaveDispatchedActions(['loadSuggestionsFailure'])+ .toMatchValues({ suggestions: [] })+ })+ })+describe('checkUrlIsAuthorized', () => {const testCases: { url: string; authorized: string[]; expected: boolean }[] = [// Legitimate matchesdiff --git a/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.ts b/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.tsindex d1e50338c1fb..4661925ae439 100644--- a/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.ts+++ b/frontend/src/lib/components/AuthorizedUrlList/authorizedUrlListLogic.ts@@ -503,10 +503,18 @@ export const authorizedUrlListLogic = kea<authorizedUrlListLogicType>([limit 25`const currentScene = sceneLogic.findMounted()?.values.activeSceneId ?? 'Settings'- const response = await api.queryHogQL(query, {- scene: currentScene,- productKey: 'platform_and_support',- })+ let response: Awaited<ReturnType<typeof api.queryHogQL>>+ try {+ response = await api.queryHogQL(query, {+ scene: currentScene,+ productKey: 'platform_and_support',+ })+ } catch {+ // Suggestions are advisory. A failed query (server error or network error) leaves the+ // list empty and the manual "Fetch suggestions" retry available, so we swallow it here+ // instead of letting it surface as an unhandled loader error.+ return []+ }breakpoint()const result = response.results as [string, number][]