: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(postgres): stop retrying a disabled database endpoint (#107772)
Tom Owers566ab4a86cc4
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.pyindex 8f12a1f754d2..80f4c1873941 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py@@ -935,6 +935,18 @@ class PostgresSource(SQLSource[PostgresSourceConfig], SSHTunnelMixin, ValidateDa"transfer quota. Upgrade your provider's plan or wait for the quota to reset, then ""re-enable the sync."),+ # A Neon-style proxy refuses the connection because the compute endpoint itself has been+ # disabled — distinct from the quota entries above, which describe a database that's+ # still enabled but out of allowance. A disabled endpoint doesn't auto-wake on connect+ # like a normally suspended one; only an explicit API/console call re-enables it, so every+ # retry re-hits the same refusal. Match the stable provider sentence; it carries no host+ # or account detail.+ "The endpoint has been disabled": (+ "Your database provider has disabled the compute endpoint, so PostHog can't connect "+ '("The endpoint has been disabled"). This usually happens when a usage limit is '+ "exceeded or the endpoint was disabled manually. Re-enable the endpoint from your "+ "provider's dashboard or API, then re-enable the sync."+ ),# The same provider family names some quotas in the refusal and others not at all# ("has exceeded the quota"), so the two keys above miss those wordings and the raw# libpq line — carrying the customer's host and port — is retried and then stored.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.pyindex 82281e5c6852..051c0f00714f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py@@ -847,6 +847,23 @@ class TestPostgresSourceNonRetryableErrors:assert friendly, f"Exceeded provider quota error should surface an actionable message: {error_msg}"assert expected_fragment in friendly[0]+ @pytest.mark.parametrize(+ "error_msg",+ [+ # A Neon-style proxy refuses the connection because the compute endpoint has been+ # disabled (distinct from the quota entries above, which describe a still-enabled+ # database). Host/IP and port are volatile and excluded from the match.+ 'connection failed: connection to server at "203.0.113.10", port 5432 failed: ERROR: '+ "The endpoint has been disabled. Enable it using the API and retry.",+ "OperationalError: The endpoint has been disabled. Enable it using the API and retry.",+ ],+ )+ def test_endpoint_disabled_is_non_retryable_with_friendly_message(self, source, error_msg):+ non_retryable = source.get_non_retryable_errors()+ friendly = [reason for pattern, reason in non_retryable.items() if pattern in error_msg and reason]+ assert friendly, f"Disabled-endpoint error should surface an actionable message: {error_msg}"+ assert "endpoint" in friendly[0]+@pytest.mark.parametrize("error_msg",[