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(cdp): treat postgres getaddrinfo ENOTFOUND as transient (#108193)

Harley Alexanderda8258d062a3
diff --git a/nodejs/src/common/utils/db/postgres.ts b/nodejs/src/common/utils/db/postgres.ts
index 8ea8df271bfb..ee7011d85ba9 100644
--- a/nodejs/src/common/utils/db/postgres.ts
+++ b/nodejs/src/common/utils/db/postgres.ts
@@ -54,6 +54,7 @@ const POSTGRES_UNAVAILABLE_ERROR_MESSAGES = [
'no more connections allowed',
'server closed the connection unexpectedly',
'getaddrinfo EAI_AGAIN',
+ 'getaddrinfo ENOTFOUND', // Cluster DNS briefly answering NXDOMAIN for the PgBouncer service name
'Connection terminated unexpectedly',
'ECONNREFUSED',
'ECONNRESET', // Connection reset by peer, e.g. PgBouncer/PG closed an idle or in-flight connection
diff --git a/nodejs/tests/utils/db/postgres.test.ts b/nodejs/tests/utils/db/postgres.test.ts
index 3071c80419ad..589f751a3ed7 100644
--- a/nodejs/tests/utils/db/postgres.test.ts
+++ b/nodejs/tests/utils/db/postgres.test.ts
@@ -9,6 +9,7 @@ describe('isTransientPgError', () => {
['no more connections allowed (max_client_conn)'],
['server closed the connection unexpectedly'],
['getaddrinfo EAI_AGAIN pg'],
+ ['getaddrinfo ENOTFOUND pgbouncer-cloud-read'],
['Connection terminated unexpectedly'],
['connect ECONNREFUSED 127.0.0.1:5432'],
['read ECONNRESET'],
@@ -44,6 +45,7 @@ describe('handlePostgresError', () => {
['no more connections allowed (max_client_conn)'],
['server closed the connection unexpectedly'],
['getaddrinfo EAI_AGAIN pg'],
+ ['getaddrinfo ENOTFOUND pgbouncer-cloud-read'],
['Connection terminated unexpectedly'],
['connect ECONNREFUSED 127.0.0.1:5432'],
['read ECONNRESET'],