: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(google_search_console): treat deleted integration as non-retryable (#67101)
Tom Owers20e06ec216d1
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.pyindex 88517e31e305..141628a9f420 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py@@ -57,6 +57,10 @@ class GoogleSearchConsoleSource("401 Client Error": "Your Google Search Console connection is invalid or expired. Please reconnect your account.","403 Client Error": "PostHog is not authorized to read this Search Console property. Please make sure the connected Google account has access to the property.","ACCESS_TOKEN_SCOPE_INSUFFICIENT": "Insufficient permissions. Please reconnect your Google Search Console account with the required scopes.",+ # `Integration.DoesNotExist` is raised by `_get_integration` when the source config still+ # references an OAuth integration row that has since been deleted (account disconnected).+ # No retry can recreate the row, so stop and ask the user to reconnect.+ "Integration matching query does not exist": "The Google Search Console connection for this source no longer exists. Please reconnect your Google account.",# `RefreshError: invalid_grant` is raised while AuthorizedSession refreshes the OAuth# access token — the stored refresh token has been revoked, expired, or invalidated# (app access revoked, password change, long inactivity). It never recovers on retry,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.pyindex ec9d098ccf95..6deaba9e3046 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py@@ -96,6 +96,13 @@ def test_invalid_grant_is_non_retryable(error_message):assert any(key in error_message for key in non_retryable_errors)+def test_missing_integration_is_non_retryable():+ # The message raised mid-sync by Integration.objects.get when the row was deleted.+ error_message = "Integration matching query does not exist."+ non_retryable_errors = GoogleSearchConsoleSource().get_non_retryable_errors()+ assert any(key in error_message for key in non_retryable_errors)++@pytest.mark.parametrize("status_code,expected_substring",[