Skip to content

: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.

fix(onboarding): swallow reverse proxy check errors instead of toasting (#59227)

posthog[bot]a8959a7dd199
diff --git a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts
index 89a381fa41d4..7265eae76f60 100644
--- a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts
+++ b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts
@@ -1,4 +1,7 @@
import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
+
+import { lemonToast } from '@posthog/lemon-ui'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -75,4 +78,39 @@ describe('reverseProxyCheckerLogic', () => {
hasReverseProxy: true,
})
})
+
+ it('should swallow server errors silently instead of showing a toast', async () => {
+ // Regression test: previously a 500 from the HogQL endpoint would propagate
+ // through kea-loaders and surface a user-visible
+ // 'Load has reverse proxy failed: A server error occurred' toast on every
+ // scene that mounts ProductSetupButton.
+ useMocks({
+ post: {
+ '/api/environments/:team_id/query/:kind': () => [500, { detail: 'A server error occurred' }],
+ },
+ })
+
+ const toastErrorSpy = jest.spyOn(lemonToast, 'error').mockImplementation(() => '')
+ const captureExceptionSpy = jest.spyOn(posthog, 'captureException').mockImplementation(() => undefined)
+
+ logic.mount()
+
+ await expectLogic(logic, () => {
+ logic.actions.loadHasReverseProxy()
+ })
+ .toFinishAllListeners()
+ .toMatchValues({
+ hasReverseProxy: false,
+ })
+
+ expect(toastErrorSpy).not.toHaveBeenCalled()
+ expect(captureExceptionSpy).toHaveBeenCalledWith(
+ expect.objectContaining({
+ message: expect.stringContaining('reverseProxyCheckerLogic: loadHasReverseProxy query failed'),
+ })
+ )
+
+ toastErrorSpy.mockRestore()
+ captureExceptionSpy.mockRestore()
+ })
})
diff --git a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts
index 2fe839b48c61..65d22777d5bd 100644
--- a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts
+++ b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts
@@ -1,5 +1,6 @@
import { afterMount, kea, listeners, path } from 'kea'
import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'
@@ -34,11 +35,21 @@ export const reverseProxyCheckerLogic = kea<reverseProxyCheckerLogicType>([
LIMIT 10`
const currentScene = sceneLogic.findMounted()?.values.activeSceneId ?? 'Onboarding'
- const res = await api.queryHogQL(query, {
- scene: currentScene,
- productKey: 'platform_and_support',
- })
- return !!res.results?.find((x) => !!x[0])
+ try {
+ const res = await api.queryHogQL(query, {
+ scene: currentScene,
+ productKey: 'platform_and_support',
+ })
+ return !!res.results?.find((x) => !!x[0])
+ } catch (error) {
+ // This check is advisory (used only to auto-complete a setup task).
+ // Swallow errors so kea-loaders does not surface a user-visible toast
+ // on every scene that mounts ProductSetupButton.
+ posthog.captureException(
+ new Error('reverseProxyCheckerLogic: loadHasReverseProxy query failed', { cause: error })
+ )
+ return values.hasReverseProxy
+ }
},
},
],