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(convex): retry Cloudflare 530 DNS errors instead of failing the sync (#75596)

Tom Owersec35a5a34ade
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.py
index d5c8d2a8f7a1..271dee1791d6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.py
@@ -26,11 +26,13 @@ logger = logging.getLogger(__name__)
# Convex deployments are served behind Cloudflare, which surfaces transient edge/origin
# problems as the 52x family (520 Unknown Error, 521 Web Server Down, 522 Connection Timed
-# Out, 523 Origin Unreachable, 524 Timeout). These are retryable just like the standard 5xx
-# codes, but urllib3's default forcelist doesn't include them — so a single transient 520
-# would otherwise fail the whole sync. All Convex requests are idempotent GETs, so retrying
-# them is safe. Derive from DEFAULT_RETRY so backoff/total/allowed-methods stay in sync.
-_CLOUDFLARE_TRANSIENT_STATUSES = frozenset({520, 521, 522, 523, 524})
+# Out, 523 Origin Unreachable, 524 Timeout) plus 530, which Cloudflare emits for edge-side
+# DNS resolution hiccups reaching the origin (its 1xxx error subcodes). These are retryable
+# just like the standard 5xx codes, but urllib3's default forcelist doesn't include them —
+# so a single transient 520/530 would otherwise fail the whole sync. All Convex requests are
+# idempotent GETs, so retrying them is safe. Derive from DEFAULT_RETRY so backoff/total/
+# allowed-methods stay in sync.
+_CLOUDFLARE_TRANSIENT_STATUSES = frozenset({520, 521, 522, 523, 524, 530})
_CONVEX_RETRY = DEFAULT_RETRY.new(
status_forcelist=frozenset(DEFAULT_RETRY.status_forcelist) | _CLOUDFLARE_TRANSIENT_STATUSES
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
index 288c952d1228..e2fffcf77d61 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py
@@ -311,6 +311,7 @@ class TestConvexRetryPolicy:
("cf_522_connection_timed_out", 522, True),
("cf_523_origin_unreachable", 523, True),
("cf_524_timeout", 524, True),
+ ("cf_530_dns_error", 530, True),
# Standard transient codes inherited from DEFAULT_RETRY must still be retried.
("rate_limited_429", 429, True),
("internal_500", 500, True),