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(appsflyer): treat 416 report rejection as non-retryable (#67623)

Tom Owersa2ea0391534d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.py
index 5665f08f48c1..5c3569012f4a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.py
@@ -54,6 +54,10 @@ class AppsFlyerSource(SimpleSource[AppsFlyerSourceConfig]):
"401 Client Error: Unauthorized for url: https://hq1.appsflyer.com": "AppsFlyer authentication failed. Please check your API token (V2).",
"403 Client Error: Forbidden for url: https://hq1.appsflyer.com": "AppsFlyer denied access. Please check that your account's subscription includes the aggregate Pull API and the app id is correct.",
"404 Client Error: Not Found for url: https://hq1.appsflyer.com": "AppsFlyer app not found. Please check the app id.",
+ # AppsFlyer overloads 416 as a catch-all for request/authorization validation failures on
+ # the aggregate Pull API (e.g. the account isn't authorized for this report or app id). The
+ # request shape is fixed, so retrying the identical call can never satisfy it.
+ "416 Client Error: Requested Range Not Satisfiable for url: https://hq1.appsflyer.com": "AppsFlyer rejected the report request. Please check that your account's subscription is authorized for this report and that the app id is correct.",
}
@property
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer_source.py
index 876e2623d872..d41f9a8e6bda 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer_source.py
@@ -56,6 +56,7 @@ class TestAppsFlyerSource:
"401 Client Error: Unauthorized for url: https://hq1.appsflyer.com/api/agg-data/export/app/id123/daily_report/v5",
"403 Client Error: Forbidden for url: https://hq1.appsflyer.com/api/agg-data/export/app/id123/geo_by_date_report/v5",
"404 Client Error: Not Found for url: https://hq1.appsflyer.com/api/agg-data/export/app/nope/daily_report/v5",
+ "416 Client Error: Requested Range Not Satisfiable for url: https://hq1.appsflyer.com/api/agg-data/export/app/id123/geo_by_date_report/v5?from=2024-01-01&to=2024-01-05",
],
)
def test_non_retryable_errors_match_auth_failures(self, observed_error):