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(setup-detection): treat wrapped network errors as an outage in the probe (#130350)

Rafael Audibert916cee42f0d9
diff --git a/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.test.ts b/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.test.ts
index e5b054eb99db..3fe6f9dbf4cc 100644
--- a/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.test.ts
+++ b/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.test.ts
@@ -2,7 +2,7 @@ import { MOCK_DEFAULT_PROJECT, MOCK_DEFAULT_TEAM } from 'lib/api.mock'
import { expectLogic } from 'kea-test-utils'
-import { ApiError } from 'lib/api-error'
+import { ApiError, NetworkError } from 'lib/api-error'
import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'
import { projectLogic } from 'scenes/projectLogic'
import { teamLogic } from 'scenes/teamLogic'
@@ -56,7 +56,7 @@ describe('createSetupDetectionLogic', () => {
it.each([
['a 500', new ApiError('A server error occurred.', 500), 'detectStatusSuccess'],
['a 403', new ApiError('You do not have permission.', 403), 'detectStatusSuccess'],
- ['a dropped connection', new TypeError('Failed to fetch'), 'detectStatusSuccess'],
+ ['a dropped connection', new NetworkError('network', new TypeError('Failed to fetch')), 'detectStatusSuccess'],
[
'a 404 for a route not yet deployed',
new ApiError('Not found.', 404, undefined, { detail: 'Not found.' }),
diff --git a/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.ts b/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.ts
index dd177f02381e..00086853e288 100644
--- a/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.ts
+++ b/frontend/src/lib/components/ProductEmptyState/setupDetectionLogic.ts
@@ -16,6 +16,7 @@ import {
isBrowserNetworkFailure,
isScopeNotFoundError,
isUnavailableEndpointError,
+ NetworkError,
readableErrorMessage,
} from 'lib/api-error'
import { projectLogic } from 'scenes/projectLogic'
@@ -303,7 +304,7 @@ async function detectOrNullOnOutageOrForbidden(
onForbidden()
return null
}
- if (isBrowserNetworkFailure(error) || isUnanswerableProbeResponse(error)) {
+ if (error instanceof NetworkError || isBrowserNetworkFailure(error) || isUnanswerableProbeResponse(error)) {
return null
}
throw error