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): recognize raw-data 400 rejections after the export redirect (#99520)

Tom Owers8c70970cc9f7
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 6cf08854d60f..11db41e21507 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
@@ -62,6 +62,9 @@ class AppsFlyerSource(SimpleSource[AppsFlyerSourceConfig]):
# used up, the date range predates the raw-data lookback limit, or the row cap is
# invalid. None of those change if we send the identical call again.
"400 Client Error: Bad Request for url: https://hq1.appsflyer.com": "AppsFlyer rejected the report request. Your account's daily quota for this report may be used up, which resets at 00:00 UTC. Otherwise please check that your subscription includes this report.",
+ # Raw-data pulls redirect to a signed download URL on this host once the request is
+ # accepted, so a raw-data rejection surfaces here instead of on hq1.appsflyer.com.
+ "400 Client Error: Bad Request for url: https://rawdata.appsflyer.com": "AppsFlyer rejected the report request. Your account's daily quota for this report may be used up, which resets at 00:00 UTC. Otherwise please check that your subscription includes this report.",
# 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.
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 caaea40901eb..4284404391cf 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
@@ -32,6 +32,9 @@ class TestAppsFlyerSource:
"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",
"400 Client Error: Bad Request for url: https://hq1.appsflyer.com/api/raw-data/export/app/id123/installs_report/v5?from=2024-01-01&to=2024-01-07",
+ # Raw-data pulls redirect to a signed download URL on a different host once accepted,
+ # so a rejection there carries that host instead of hq1.appsflyer.com.
+ "400 Client Error: Bad Request for url: https://rawdata.appsflyer.com/export/token/abc123",
],
)
def test_non_retryable_errors_match_auth_failures(self, observed_error):