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(warehouse-sources): stop paging on Apollo rate limits (#89897)

posthog[bot]a5be1ef67e78
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/source.py
index 6a3ef1f99d03..25a1d21cc488 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/source.py
@@ -51,6 +51,12 @@ class ApolloSource(ResumableSource[ApolloSourceConfig, ApolloResumeConfig]):
"403 Client Error: Forbidden for url: https://api.apollo.io": "Apollo denied access. API access requires a paid Apollo plan, and some endpoints need a master API key.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # fetch_page exhausts its Retry-After backoff on a 429, then re-raises so Temporal
+ # retries the activity from saved page state. The import self-recovers, so log the
+ # rate limit at warning instead of raising an error tracking issue.
+ return {"Apollo API error (retryable)"}
+
@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/tests/test_apollo_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/tests/test_apollo_source.py
index 684a7c3ec7c5..894797193a62 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/tests/test_apollo_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/apollo/tests/test_apollo_source.py
@@ -34,6 +34,12 @@ class TestApolloSource:
non_retryable_errors = self.source.get_non_retryable_errors()
assert not any(key in other_vendor_error for key in non_retryable_errors)
+ def test_retryable_errors_match_rate_limit_raise(self):
+ # The string fetch_page re-raises after exhausting its Retry-After backoff.
+ observed_error = "Apollo API error (retryable): status=429, url=https://api.apollo.io/api/v1/contacts/search"
+ retryable_errors = self.source.get_retryable_errors()
+ assert any(key in observed_error for key in retryable_errors)
+
def test_get_schemas(self):
schemas = self.source.get_schemas(self.config, self.team_id)