: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 the generic server-error detail reaching the source wizard (#94958)
Tom Owersdaadb02f06cb
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsxindex 23d4b8b993a4..6192f0cb891b 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx@@ -262,8 +262,13 @@ function webhookResultHasNoPendingInputs(webhookResult: WebhookCreateResult | nu// A thrown fetch has no HTTP status, so its message is the raw "Failed to fetch", most often an ad// blocker or extension blocking the request. Name that likely cause instead of echoing it.+// Django REST Framework's placeholder detail for an unhandled 500. It carries no more meaning+// than the status code itself, so don't let it stand in for a message the source wrote.+const GENERIC_SERVER_ERROR_DETAIL = 'A server error occurred.'+export function resolveConnectErrorMessage(e: any): string {- const apiMessage = e?.data?.message ?? e?.detail+ const detail = e?.detail === GENERIC_SERVER_ERROR_DETAIL ? undefined : e?.detail+ const apiMessage = e?.data?.message ?? detailif (apiMessage) {return apiMessage}diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.tsindex 284f74443041..663ef9e78701 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts@@ -101,6 +101,14 @@ describe('sourceWizardLogic', () => {)})+ it('replaces the generic server-error detail with connection guidance', () => {+ // 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).not.toContain('A server error occurred.')+ })+it('never returns undefined for a 4xx with no message body', () => {const message = resolveConnectErrorMessage({ status: 400 })expect(message).toBeTruthy()