: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(first-promoter): explain a 404 as an unresolved account id (#83615)
Tom Owerse26c51fa5b94
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/first_promoter.py b/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/first_promoter.pyindex 4423baa3156c..3f29104bb3c7 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/first_promoter.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/first_promoter.py@@ -273,4 +273,12 @@ def validate_credentials(api_key: str, account_id: str, api_version: str) -> tup"FirstPromoter rejected these credentials. Check the API key and account ID under ""Settings > Integrations > Manage API keys.",)+ # The key was accepted (else 401/403), so a 404 on the fixed v2 path means the account id+ # doesn't resolve to a company — point the user at the account id rather than a raw status.+ if response.status_code == 404:+ return (+ False,+ "FirstPromoter couldn't find an account for that account ID. Check the account ID "+ "under Settings > Integrations > Manage API keys, then try again.",+ )return False, f"FirstPromoter API returned an unexpected status code: {response.status_code}"diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/tests/test_first_promoter.py b/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/tests/test_first_promoter.pyindex 55732e40fe85..23bfa60198f8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/tests/test_first_promoter.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/first_promoter/tests/test_first_promoter.py@@ -189,6 +189,7 @@ class TestFirstPromoterTransport:(200, True, None),(401, False, "rejected these credentials"),(403, False, "rejected these credentials"),+ (404, False, "couldn't find an account for that account ID"),(500, False, "unexpected status code"),])