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(supabase): explain pooler auth_query failures during source setup (#111259)

Tom Owerscab6b197a42a
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.py
index 2b1e89dd67b3..f26e2d97dcaa 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
@@ -183,6 +183,18 @@ PostgresErrors = {
"database project is paused or deleted, or the pooler username/host is wrong. Check that "
"your database is active and the connection details are correct."
),
+ # Supavisor runs an `auth_query` against the tenant's database to fetch the user's password
+ # secret. These two "(EAUTHQUERY)" outcomes are permanent, unlike the "secret check timed out"
+ # race `postgres.py` retries: the user doesn't exist, or its password is stored in a format the
+ # pooler can't verify (no password, or a non-SCRAM hash). Setting the password again stores it
+ # as SCRAM.
+ "user not found in the database": (
+ "Your database doesn't have a user with the username you entered. Check the user for this source and try again."
+ ),
+ "unsupported or invalid secret format": (
+ "Your connection pooler can't check this user's password because of how your database "
+ "stores it. Reset the user's password in your database, then try again."
+ ),
# Supabase/Supavisor's shared regional pooler (aws-0-<region>.pooler.supabase.com) can't
# identify the project from SNI, so the pooler username must embed the project ref (for example
# "postgres.<project-ref>"). A plain "postgres" username leaves it nothing to route on and it
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.py
index 69f3b66f20af..02370b076ec1 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
@@ -5097,6 +5097,18 @@ class TestValidateCredentialsErrorMapping:
"Your database provider rejected the connection because PostHog's IP address isn't on its IP "
"allow list. Add PostHog's IP addresses to that allow list, then try again.",
),
+ (
+ 'connection failed: connection to server at "203.0.113.20", port 5432 failed: '
+ "FATAL: (EAUTHQUERY) user not found in the database",
+ "Your database doesn't have a user with the username you entered. Check the user for this "
+ "source and try again.",
+ ),
+ (
+ 'connection failed: connection to server at "203.0.113.20", port 5432 failed: '
+ "FATAL: (EAUTHQUERY) unsupported or invalid secret format",
+ "Your connection pooler can't check this user's password because of how your database "
+ "stores it. Reset the user's password in your database, then try again.",
+ ),
# A proxy/pooler in front of some providers rejects bad credentials during its own
# database-identification step, wrapping the rejection in its own sentence instead of
# libpq's "password authentication failed for user".