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(data-warehouse): clarify the error shown when a database connection times out (#78946)

Tom Owers216d2bf29034
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py
index 1dc0be408c26..c81e64964abd 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py
@@ -97,7 +97,7 @@ ClickHouseErrors: dict[str, str] = {
"nodename nor servname provided": "Could not resolve the ClickHouse host",
"name or service not known": "Could not resolve the ClickHouse host",
"connection refused": "Could not connect to ClickHouse on the given host/port",
- "connection timed out": "Connection to ClickHouse timed out. Does your database have our IP addresses allow-listed?",
+ "connection timed out": "Connection to ClickHouse timed out. Check that your database is reachable from the public internet and that PostHog's egress IP addresses are allowed through your firewall (see the docs). For a database that can't be exposed publicly, use the SSH tunnel option.",
# Must stay above the generic "ssl" entry, which would otherwise match first and send the
# user to the wrong toggle. Verification runs against the configured ClickHouse host even
# over an SSH tunnel (server_hostname), so a mismatch is real: the certificate doesn't
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
index 56a217457f9c..0b6c8795b606 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
@@ -60,7 +60,10 @@ _VALIDATE_CONNECTION_HINTS: list[tuple[str, str]] = [
"Connection refused",
"Could not connect to the host on the port given. Check the host and port are correct and the MySQL server is accepting connections.",
),
- ("timed out", "Connection timed out. Does your database have our IP addresses allowed?"),
+ (
+ "timed out",
+ "Connection timed out. Check that your database is reachable from the public internet and that PostHog's egress IP addresses are allowed through your firewall (see the docs). For a database that can't be exposed publicly, use the SSH tunnel option.",
+ ),
(
"No route to host",
"Could not reach the host. Check the host is correct and that PostHog's IP addresses are allowed through your firewall.",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py
index c7aa7f0a221a..dfe46b9c9239 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py
@@ -2188,7 +2188,7 @@ class TestMySQLSourceValidateCredentials:
),
(
pymysql.err.OperationalError(2003, "Can't connect to MySQL server on 'db.example.com' (timed out)"),
- "Connection timed out. Does your database have our IP addresses allowed?",
+ "Connection timed out. Check that your database is reachable from the public internet and that PostHog's egress IP addresses are allowed through your firewall (see the docs). For a database that can't be exposed publicly, use the SSH tunnel option.",
),
(
pymysql.err.OperationalError(
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 acb723858a73..2cd2e82ab8c6 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
@@ -137,7 +137,7 @@ PostgresErrors = {
"No route to host": _HOST_UNREACHABLE_ERROR,
"Is the server running on that host and accepting TCP/IP connections": "Could not connect to the host on the port given",
'database "': "Database does not exist",
- "timeout expired": "Connection timed out. Does your database have our IP addresses allowed?",
+ "timeout expired": "Connection timed out. Check that your database is reachable from the public internet and that PostHog's egress IP addresses are allowed through your firewall (see the docs). For a database that can't be exposed publicly, use the SSH tunnel option.",
"the database system is starting up": "Your database is starting up or recovering. Wait a moment and try again.",
"SSL/TLS connection is required": "SSL/TLS connection is required but your database does not support it. Please enable SSL/TLS on your PostgreSQL server.",
"server does not support SSL, but SSL was required": "SSL/TLS connection is required but your database does not support it. Please enable SSL/TLS on your PostgreSQL server.",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.py
index 2393bf07e732..8df8a3ec9f14 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.py
@@ -45,7 +45,7 @@ RedshiftErrors = {
"could not translate host name": "Could not connect to the host",
"Is the server running on that host and accepting TCP/IP connections": "Could not connect to the host on the port given",
'database "': "Database does not exist",
- "timeout expired": "Connection timed out. Does your database have our IP addresses allowed?",
+ "timeout expired": "Connection timed out. Check that your database is reachable from the public internet and that PostHog's egress IP addresses are allowed through your firewall (see the docs). For a database that can't be exposed publicly, use the SSH tunnel option.",
"SSL connection has been closed unexpectedly": "SSL connection error. Please check your SSL settings.",
"server does not support SSL": "The server does not support SSL, which we require for Redshift. Please check the host and port point to your Redshift cluster.",
"Connection refused": "Connection refused. Please check the host and port.",