: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(hubspot): treat deleted integration as non-retryable (#63675)
Tom Owersfdc2843fe6b5
diff --git a/posthog/temporal/data_imports/sources/hubspot/source.py b/posthog/temporal/data_imports/sources/hubspot/source.pyindex 464951bc83a3..a357635d4aff 100644--- a/posthog/temporal/data_imports/sources/hubspot/source.py+++ b/posthog/temporal/data_imports/sources/hubspot/source.py@@ -99,6 +99,10 @@ class HubspotSource(ResumableSource[HubspotSourceConfig | HubspotSourceOldConfig"Hubspot refresh token not found": "Your HubSpot connection is missing its refresh token. Please reconnect it.",# Raised by source_for_pipeline (OAuth path) when the integration is missing its access or refresh token."Hubspot refresh or access token not found": "Your HubSpot connection is missing its refresh token. Please reconnect it.",+ # Raised by OAuthMixin.get_oauth_integration when the referenced integration row no longer+ # exists (e.g. the HubSpot connection was deleted while the source still points at it).+ # Retrying cannot recreate a deleted integration. Match the stable prefix, not the volatile id.+ "Integration not found": "The linked HubSpot integration no longer exists. Please reconnect your HubSpot account.",}# TODO: clean up hubspot job inputs to not have two auth config optionsdiff --git a/posthog/temporal/data_imports/sources/hubspot/test/test_source_routing.py b/posthog/temporal/data_imports/sources/hubspot/test/test_source_routing.pyindex 278cecbecfea..aaf8027ca7eb 100644--- a/posthog/temporal/data_imports/sources/hubspot/test/test_source_routing.py+++ b/posthog/temporal/data_imports/sources/hubspot/test/test_source_routing.py@@ -226,6 +226,9 @@ class TestSettingsShape:"Hubspot refresh token not found for job 019cdc50-67a5-0000-c023-0d6a4e057e9b",# HubspotSourceConfig OAuth path"Hubspot refresh or access token not found for job 019cdc50-67a5-0000-c023-0d6a4e057e9b",+ # OAuthMixin.get_oauth_integration when the integration row was deleted (id varies per source)+ "Integration not found: 56366",+ "Integration not found: 157288",],)def test_missing_token_error_is_non_retryable(error_msg: str) -> None: