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(hubspot): treat OAuth token rate limit as retryable, not tracked (#78536)

Tom Owers398e43a387b9
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py
index 6b10273f7f2e..094f111a3efb 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py
@@ -142,6 +142,12 @@ class HubspotSource(ResumableSource[HubspotSourceConfig | HubspotSourceOldConfig
"Hubspot search malformed JSON response (retryable)",
"Hubspot v4 associations error (retryable): status=",
"Hubspot v4 associations malformed JSON response (retryable)",
+ # auth.hubspot_refresh_access_token also retries in-process (5 attempts, Retry-After
+ # aware) before re-raising HubspotRetryableError with HubSpot's own 429 body verbatim
+ # (no code-added prefix, unlike the fetch-loop errors above). Match HubSpot's stable,
+ # documented rate-limit wording so this self-recovering condition doesn't get tracked
+ # as noise once Temporal's activity retry picks it back up.
+ "You have reached your rate limit.",
}
# TODO: clean up hubspot job inputs to not have two auth config options
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py
index a0c6c7b10fb1..a03f4cc568e7 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py
@@ -313,6 +313,8 @@ def test_missing_token_error_is_non_retryable(error_msg: str) -> None:
"url=https://api.hubapi.com/crm/v4/associations/contacts/deals/batch/read",
"Hubspot v4 associations malformed JSON response (retryable): "
"url=https://api.hubapi.com/crm/v4/associations/contacts/deals/batch/read",
+ # auth.hubspot_refresh_access_token, exhausted after tenacity's 5 in-process attempts
+ "You have reached your rate limit.",
],
)
def test_transient_http_error_is_retryable(error_msg: str) -> None: