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): name the host in the DNS-resolution error (#65054)

Tom Owers13c91bc88961
diff --git a/posthog/temporal/data_imports/sources/common/mixins.py b/posthog/temporal/data_imports/sources/common/mixins.py
index a77141d883f8..7980cfb94647 100644
--- a/posthog/temporal/data_imports/sources/common/mixins.py
+++ b/posthog/temporal/data_imports/sources/common/mixins.py
@@ -89,7 +89,10 @@ def _is_host_safe(host: str, team_id: int) -> tuple[bool, str | None]:
return False, _INTERNAL_IP_ERROR
except socket.gaierror:
_log("block", "dns_failure", _DNS_FAILURE_ERROR)
- return False, _DNS_FAILURE_ERROR
+ return (
+ False,
+ f"Couldn't resolve the host '{host}'. Check that it's spelled correctly and reachable from the public internet.",
+ )
_log("allow", "resolved_ip", None, resolved_ips)
return True, None
diff --git a/posthog/temporal/data_imports/sources/common/test_mixins.py b/posthog/temporal/data_imports/sources/common/test_mixins.py
index b29fb83bb0e8..6fa96e8e847a 100644
--- a/posthog/temporal/data_imports/sources/common/test_mixins.py
+++ b/posthog/temporal/data_imports/sources/common/test_mixins.py
@@ -119,7 +119,9 @@ class TestIsHostSafe(SimpleTestCase):
):
valid, error = _is_host_safe("nonexistent.invalid", team_id=999)
assert not valid
- assert error == "Host could not be resolved"
+ assert error is not None
+ assert "nonexistent.invalid" in error
+ assert "resolve" in error
@override_settings(CLOUD_DEPLOYMENT="US")
def test_blocked_host_logs_warning(self):