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): tolerate a missing https scheme on Convex deploy URLs (#62432)

Tom Owersb7ce822c2503
diff --git a/posthog/temporal/data_imports/sources/convex/convex.py b/posthog/temporal/data_imports/sources/convex/convex.py
index c99dc600639d..b1a3b1ecd8cf 100644
--- a/posthog/temporal/data_imports/sources/convex/convex.py
+++ b/posthog/temporal/data_imports/sources/convex/convex.py
@@ -39,7 +39,13 @@ def validate_deploy_url(deploy_url: str) -> str:
Enforces https scheme, host matching *.convex.cloud, no query/fragment.
Returns the validated base URL (scheme + host, no trailing slash).
"""
- parsed = urlparse(deploy_url.strip())
+ deploy_url = deploy_url.strip()
+ # Tolerate a missing scheme — users routinely paste the bare host. We only add
+ # https when no scheme is present; an explicit http:// is still rejected below.
+ if deploy_url and "://" not in deploy_url:
+ deploy_url = f"https://{deploy_url}"
+
+ parsed = urlparse(deploy_url)
if parsed.scheme != "https":
raise InvalidDeployUrlError(
diff --git a/posthog/temporal/data_imports/sources/convex/tests/test_convex.py b/posthog/temporal/data_imports/sources/convex/tests/test_convex.py
index d4a7316abc85..ac3efeb2d616 100644
--- a/posthog/temporal/data_imports/sources/convex/tests/test_convex.py
+++ b/posthog/temporal/data_imports/sources/convex/tests/test_convex.py
@@ -53,10 +53,17 @@ class TestValidateDeployUrl:
"https://clever-falcon-77.us-east-1.convex.cloud",
"https://clever-falcon-77.us-east-1.convex.cloud",
),
+ # missing scheme — normalized by prepending https://
+ ("no_scheme", "swift-lemur-123.convex.cloud", "https://swift-lemur-123.convex.cloud"),
+ (
+ "no_scheme_regional",
+ "breezy-otter-42.eu-west-1.convex.cloud",
+ "https://breezy-otter-42.eu-west-1.convex.cloud",
+ ),
+ ("no_scheme_trailing_slash", "swift-lemur-123.convex.cloud/", "https://swift-lemur-123.convex.cloud"),
# invalid — should raise
("http", "http://swift-lemur-123.convex.cloud", None),
("ftp", "ftp://swift-lemur-123.convex.cloud", None),
- ("no_scheme", "swift-lemur-123.convex.cloud", None),
("wrong_tld", "https://swift-lemur-123.convex.io", None),
("two_extra_subdomains", "https://extra.foo.swift-lemur-123.convex.cloud", None),
("lookalike", "https://convex.cloud.evil.com", None),