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(data-warehouse): surface swallowed source-wizard errors and track connect funnel (#66216)

Tom Owersb8759bdd8b5b
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
index cd65e936a976..6edf40ac5ce4 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
@@ -1330,6 +1330,15 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
actions.loadSources()
actions.markTaskAsCompleted(SetupTaskId.ConnectSource)
+ // Fires only after the source is created server-side. Unlike the intent-time
+ // `source created` capture in onSubmit (which fires before this request resolves),
+ // this measures true connect completion — use it for the real onboarding funnel.
+ posthog.capture('warehouse source connect completed', {
+ sourceType: values.selectedConnector.name,
+ accessMethod: values.source.access_method,
+ hasWebhookSchemas: values.hasWebhookSchemas,
+ })
+
// When requiredTables is set (e.g. signals setup), skip step 4 and complete directly
if (values.requiredTables && props.onComplete) {
props.onComplete()
@@ -1342,6 +1351,14 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
}
} catch (e: any) {
lemonToast.error(e.data?.message ?? e.message)
+ // Surface the failure instead of leaving it as a toast-only dead end: a captured
+ // exception keeps the stack triageable, and the event closes the connect funnel.
+ posthog.captureException(e)
+ posthog.capture('warehouse source connect failed', {
+ sourceType: values.selectedConnector?.name,
+ errorMessage: e.data?.message ?? e.message,
+ status: e.status,
+ })
} finally {
actions.setIsLoading(false)
}
@@ -1360,6 +1377,7 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
webhook_url: '',
error: e.data?.message ?? e.message ?? 'Failed to create webhook',
})
+ posthog.captureException(e)
}
},
submitWebhookFields: async () => {
@@ -1511,8 +1529,15 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
: e.message)
lemonToast.error(errorMessage)
+ // A 5xx with no body is an unexpected server failure, not a user credential
+ // mistake — capture the stack so these stay diagnosable (the report flagged
+ // swallowed generic `Error`s on this path with no captured stack).
+ if (!apiMessage && e.status >= 500) {
+ posthog.captureException(e)
+ }
+
posthog.capture('warehouse credentials invalid', {
- sourceType: values.selectedConnector.name,
+ sourceType: values.selectedConnector?.name,
errorMessage,
// Keep the raw error (status code etc.) so server-side failures stay triageable.
rawError: e.message,
@@ -1615,6 +1640,19 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
}
if (values.currentStep <= 1) {
+ // A `kind` that matches no known connector means a source card navigated here but
+ // the wizard can't advance — the "dead click on a source" failure mode. Don't fail
+ // silently: always capture it for diagnosis, and once connectors have loaded (so
+ // we know it's a genuine mismatch, not the load race) tell the user what to do.
+ if (kind) {
+ const connectorsLoaded = (values.connectors?.length ?? 0) > 0
+ posthog.capture('warehouse new source kind unresolved', { kind, connectorsLoaded })
+ if (connectorsLoaded) {
+ lemonToast.error(
+ `We couldn't open the "${kind}" connector — please pick a source from the list.`
+ )
+ }
+ }
actions.selectConnector(null)
actions.setStep(1)
}
@@ -1681,12 +1719,16 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
const loadedFile: string = await new Promise((resolve, reject) => {
const fileReader = new FileReader()
fileReader.onload = (e) => resolve(e.target?.result as string)
- fileReader.onerror = (e) => reject(e)
+ fileReader.onerror = () =>
+ reject(fileReader.error ?? new Error(`Failed to read the "${name}" file`))
fileReader.readAsText(payload['payload'][name][0])
})
fieldPayload[name] = JSON.parse(loadedFile)
- } catch {
- return lemonToast.error('File is not valid')
+ } catch (e: any) {
+ posthog.captureException(e)
+ return lemonToast.error(
+ `The "${name}" file is not valid — it must be a readable JSON file.`
+ )
}
} else {
fieldPayload[name] = payload['payload'][name]