: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(meta_ads): stop retrying invalid attribution window config (#84602)
Tom Owersd1d750c88ebb
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.pyindex 03d7413554d0..e8f1b635f7c4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/source.py@@ -142,6 +142,17 @@ class MetaAdsSource(ResumableSource[MetaAdsSourceConfig, MetaAdsResumeConfig], O"widening OAuth consent for every customer. Re-authorizing will not fix this — ""contact PostHog support if this table keeps failing."),+ # Graph API code 100: the source's "Attribution windows for insights" setting (a+ # free-text field, see `SourceFieldInputConfig` above) contains a value Meta's+ # Insights API doesn't recognise. Retrying resends the same invalid parameter, so+ # only editing the source config fixes it. Matches the message regardless of which+ # array index Meta reports as invalid.+ "action_attribution_windows[": (+ 'Meta rejected the "Attribution windows for insights" setting on this source — one '+ "of the configured values isn't a window Meta supports (e.g. 1d_click, 7d_click, "+ "28d_click, 1d_view, 7d_view, 28d_view). Fix it in your Meta Ads source settings, "+ "then run the sync again."+ ),# Meta returns this 500 when the requested query is too large for their backend to# service. Both pagination paths adapt to it (stats chunks shrink 30 → 7 → 1 day, and# both paths shrink the per-page limit 500 → 100 → 50); if it still escapes after thosediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.pyindex caac9759b112..8d58d0d2244e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/meta_ads/test_meta_ads.py@@ -1345,6 +1345,10 @@ class TestNonRetryableErrors:'Meta API request failed: 400 - {"error":{"message":"(#100) This endpoint cannot be loaded due to missing permissions."}}',# 400 when a business_management-gated field is requested without that scope.'Meta API request failed: 400 - {"error":{"message":"(#200) Requires business_management permission to manage the object.","type":"OAuthException","code":200}}',+ # 400 when the source's configured attribution windows include a value Meta's+ # Insights API doesn't recognise.+ 'Meta API request failed: 400 - {"error":{"message":"(#100) action_attribution_windows[0] must be '+ 'one of the following values: 1d_view, 7d_view, 28d_view, 1d_click, 7d_click, 28d_click","type":"OAuthException","code":100}}',# 500 when Meta's backend refuses to service the query even after adaptive# chunking has shrunk the window to its smallest size.'Meta API request failed: 500 - {"error":{"code":1,"message":"Please reduce the amount of data you\'re asking for, then retry your request"}}',