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(ux): don't report read-only mode blocks from reverse proxy check (#59645)

posthog[bot]2fa620f81730
diff --git a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts
index 7265eae76f60..ab681efba232 100644
--- a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts
+++ b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts
@@ -3,6 +3,8 @@ import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
+import { setReadOnlyGetter } from 'lib/readOnlyGuard'
+
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -113,4 +115,31 @@ describe('reverseProxyCheckerLogic', () => {
toastErrorSpy.mockRestore()
captureExceptionSpy.mockRestore()
})
+
+ it('should not report read-only mode blocks to error tracking', async () => {
+ // Regression test: the read-only guard throws ReadOnlyModeError on every POST,
+ // and afterMount fires loadHasReverseProxy on every scene mount, so reporting
+ // these floods error tracking with expected failures.
+ useMockedValues(hasReverseProxyValues)
+ setReadOnlyGetter(() => true)
+
+ const captureExceptionSpy = jest.spyOn(posthog, 'captureException').mockImplementation(() => undefined)
+
+ try {
+ logic.mount()
+
+ await expectLogic(logic, () => {
+ logic.actions.loadHasReverseProxy()
+ })
+ .toFinishAllListeners()
+ .toMatchValues({
+ hasReverseProxy: false,
+ })
+
+ expect(captureExceptionSpy).not.toHaveBeenCalled()
+ } finally {
+ captureExceptionSpy.mockRestore()
+ setReadOnlyGetter(null)
+ }
+ })
})
diff --git a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts
index 65d22777d5bd..2c0bf5b8e856 100644
--- a/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts
+++ b/frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.ts
@@ -4,6 +4,7 @@ import posthog from 'posthog-js'
import api from 'lib/api'
import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'
+import { ReadOnlyModeError } from 'lib/readOnlyGuard'
import { sceneLogic } from 'scenes/sceneLogic'
import { hogql } from '~/queries/utils'
@@ -42,6 +43,15 @@ export const reverseProxyCheckerLogic = kea<reverseProxyCheckerLogicType>([
})
return !!res.results?.find((x) => !!x[0])
} catch (error) {
+ // Read-only mode blocks every POST by design — afterMount fires on
+ // every scene, so reporting these floods error tracking with expected
+ // failures. Bail out without capturing.
+ if (
+ error instanceof ReadOnlyModeError ||
+ (error as Error)?.cause instanceof ReadOnlyModeError
+ ) {
+ return values.hasReverseProxy
+ }
// 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.