: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): classify Supavisor's nxdomain pooler failure as non-retryable (#87632)
Tom Owersa8b13a28ccef
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 5ace4d3efb1f..8e1c86aa0257 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@@ -349,6 +349,18 @@ class PostgresSource(SQLSource[PostgresSourceConfig], SSHTunnelMixin, ValidateDa"deleted, or the pooler username/host is wrong. Check that your database is active ""and the connection details are correct, then re-enable the sync."),+ # Supabase's Supavisor pooler reports a permanent DNS failure resolving its upstream+ # backend as "FATAL: Failed to connect to database: {:error, :nxdomain}" — Erlang's+ # resolver returning "no such domain", unlike the sibling ":etimedout"/":econnrefused"+ # tuples in `_CONNECTION_DROPPED_ERROR_SUBSTRINGS`, which mean a transient blip reaching+ # a backend that still exists. NXDOMAIN means the backend's DNS record is gone, which+ # happens when the underlying project is paused or deleted — permanent until the+ # customer restores it, so don't retry. Match the stable erlang-tuple fragment.+ "{:error, :nxdomain}": (+ "Your database connection pooler couldn't resolve your database's address "+ '("nxdomain"). This usually means the database project is paused or deleted. Check '+ "that your database is active, then re-enable the sync."+ ),# Supabase/Supavisor poolers reject a connection that carries no tenant identifier with# "FATAL: (ENOIDENTIFIER) no tenant identifier provided (external_id or sni_hostname# required)". The shared regional pooler host (e.g. aws-0-<region>.pooler.supabase.com)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 255fa23d9a0d..fe016d2b0996 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@@ -753,6 +753,21 @@ class TestPostgresSourceNonRetryableErrors:is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())assert is_non_retryable, f"Missing pooler tenant/user error should be non-retryable: {error_msg}"+ @pytest.mark.parametrize(+ "error_msg",+ [+ # Supavisor's Erlang resolver can't find a DNS record for its upstream backend — the+ # stable signal that the underlying project is paused or deleted. Distinct from the+ # sibling ":etimedout"/":econnrefused" tuples, which are transient and stay retryable.+ 'connection failed: connection to server at "203.0.113.10", port 5432 failed: FATAL: Failed to connect to database: {:error, :nxdomain}',+ 'connection failed: connection to server at "203.0.113.20", port 6543 failed: FATAL: Failed to connect to database: {:error, :nxdomain}',+ ],+ )+ def test_supavisor_nxdomain_pooler_dns_failure_is_non_retryable(self, source, error_msg):+ non_retryable = source.get_non_retryable_errors()+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())+ assert is_non_retryable, f"Supavisor nxdomain pooler DNS failure should be non-retryable: {error_msg}"+@pytest.mark.parametrize("error_msg",[