: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(google_ads): point unreachable customer id at the MCC toggle (#71439)
Tom Owersd78acd374d6c
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.pyindex 6db4cd2900d0..67dcc347ccf5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/source.py@@ -325,9 +325,15 @@ class GoogleAdsSource(customer_resource_name = f"customers/{clean_customer_id(config.customer_id)}"is_valid = customer_resource_name in accessible_customers.resource_namesif not is_valid:+ # `list_accessible_customers` returns only accounts the login can reach directly,+ # never client accounts nested under a manager. A valid client-account id therefore+ # lands here when the MCC toggle is off, so point at that toggle rather than telling+ # the user their (correct) id is wrong. Mirrors the PERMISSION_DENIED message below.return (False,- f"Customer ID {config.customer_id} is not correct. Please check your customer ID and try again.",+ f"Customer ID {config.customer_id} isn't accessible with the connected Google login. "+ "Check the ID is correct, and if it's a client account under a manager (MCC) account, "+ 'enable "Using MCC account?" and enter your manager\'s customer ID, then try again.',)return True, Noneexcept Integration.DoesNotExist:diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_google_ads_source.py b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_google_ads_source.pyindex 71e26aa324e4..fce617c9c043 100644--- a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_google_ads_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_google_ads_source.py@@ -450,7 +450,10 @@ class TestGoogleAdsSourceValidation:assert is_valid is Falseassert error is not None- assert "is not correct" in error+ # A valid client-account id nested under a manager also lands here (list_accessible_customers+ # never returns it), so the message must steer to the MCC toggle, not claim the id is wrong.+ assert "MCC" in error+ assert "is not correct" not in error@mock.patch("products.warehouse_sources.backend.temporal.data_imports.sources.google_ads.google_ads.google_ads_client"