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(postgres): treat missing pooler tenant/user as non-retryable (#63671)

Tom Owers8b2b514ff493
diff --git a/posthog/temporal/data_imports/sources/postgres/test_postgres.py b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
index ca5af4d7f498..5d98b2d99ff9 100644
--- a/posthog/temporal/data_imports/sources/postgres/test_postgres.py
+++ b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
@@ -227,6 +227,22 @@ class TestPostgresSourceNonRetryableErrors:
assert "FATAL: Tenant or user not found" not in error_msg
assert any(pattern in error_msg for pattern in non_retryable.keys())
+ @pytest.mark.parametrize(
+ "error_msg",
+ [
+ # Supabase Supavisor pooler wording when the tenant/user is gone (project paused/deleted
+ # or pooler username changed). The id between "tenant/user" and "not found" is volatile.
+ 'connection failed: connection to server at "13.238.183.126", port 5432 failed: FATAL: (ENOTFOUND) tenant/user readonly_user.yvpaylojqoditoupicws not found',
+ 'connection failed: connection to server at "44.216.29.125", port 6543 failed: FATAL: (ENOTFOUND) tenant/user postgres.xysbwpayipjbkimdauqr not found',
+ # The real production message repeats the line (newlines are normalized to spaces upstream).
+ 'connection failed: connection to server at "13.200.110.68", port 6543 failed: FATAL: (ENOTFOUND) tenant/user postgres.yszohtdqidnoqckysyff not found connection to server at "13.200.110.68", port 6543 failed: FATAL: (ENOTFOUND) tenant/user postgres.yszohtdqidnoqckysyff not found',
+ ],
+ )
+ def test_missing_pooler_tenant_or_user_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"Missing pooler tenant/user error should be non-retryable: {error_msg}"
+
@pytest.mark.parametrize(
"error_msg",
[