: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(data-warehouse): stop blaming a database when a source check fails (#107562)
Tom Owers2fb7cf78bb2d
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsxindex ed6f00e1ed19..aecba92bad8b 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx@@ -309,7 +309,9 @@ export function resolveConnectErrorMessage(e: any): string {return "PostHog couldn't reach the server to set up your source. This is often an ad blocker or browser extension blocking the request. Try pausing it or switching networks, then try again."}if (e?.status >= 500) {- return 'PostHog could not validate your connection in time. This can happen with a very large schema or a slow or unreachable database — please check your connection details and try again.'+ // Every source reaches this branch, including ones with no database behind them, so the+ // message can't name a cause only some of them have.+ return "PostHog couldn't set up your source. Check that the details you entered are correct and that the source is reachable, then try again."}// A 4xx without a message body would otherwise toast "undefined".return e?.message ?? 'Something went wrong setting up your source. Please try again.'diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.tsindex 1a198b294311..2d62750790b4 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts@@ -160,10 +160,17 @@ describe('sourceWizardLogic', () => {// DRF answers an unhandled 500 with a fixed placeholder detail. Surfacing it told the// user nothing, and it masked the 5xx branch below.const message = resolveConnectErrorMessage({ detail: 'A server error occurred.', status: 500 })- expect(message).toContain('check your connection details')+ expect(message).toContain('the details you entered')expect(message).not.toContain('A server error occurred.')})+ it('keeps the 5xx guidance free of causes only database sources have', () => {+ // Every source shares this branch, so wording aimed at a database sent users of+ // API-backed sources looking for a schema and a host they never configured.+ const message = resolveConnectErrorMessage({ status: 504 })+ expect(message).not.toMatch(/database|schema/i)+ })+it('never returns undefined for a 4xx with no message body', () => {const message = resolveConnectErrorMessage({ status: 400 })expect(message).toBeTruthy()