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(mysql): stop retrying syncs rejected by require_secure_transport (#106567)

Tom Owers543a2d14494a
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 40e8fc2938c2..a7b7dcac507c 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
@@ -308,6 +308,11 @@ class MySQLSource(SQLSource[MySQLSourceConfig], SSHTunnelMixin, ValidateDatabase
# is a deterministic config mismatch, not the transient connection-drop that 2013
# usually signals — so match only the stable SSL token, never the generic 2013 text.
"[SSL: WRONG_VERSION_NUMBER]": "We couldn't establish an SSL connection to your MySQL server — it responded as if SSL is not enabled. If your server (or a proxy in front of it) doesn't support SSL, set 'Use SSL?' to No; otherwise check that you're connecting to an SSL-enabled host and port.",
+ # MySQL error 3159 (ER_SECURE_TRANSPORT_REQUIRED): the server runs with
+ # `require_secure_transport=ON` but the source has SSL turned off, so every connect is
+ # rejected before auth. Match the locale-independent code, as the message is translated
+ # on non-English servers.
+ "(3159,": "Your MySQL server only accepts encrypted connections, but SSL is turned off for this source. Set 'Use SSL?' to Yes in your source settings, then re-enable the sync.",
# Raised from the shared `_decimal_array_from_values` fallback in
# `pipelines/core/arrow_utils.py` when a numeric/decimal value exceeds Delta Lake's
# decimal budget (precision > 76 or scale > 32). Fixed source-data shape — retrying
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 a617893cc73a..03c04ec71492 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
@@ -2101,6 +2101,19 @@ class TestMySQLSourceNonRetryableErrors:
is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())
assert is_non_retryable, f"SSL version mismatch should be non-retryable: {error_msg}"
+ @pytest.mark.parametrize(
+ "error_msg",
+ [
+ "(3159, 'Connections using insecure transport are prohibited while --require_secure_transport=ON.')",
+ "OperationalError: (3159, 'Connections using insecure transport are prohibited while "
+ "--require_secure_transport=ON.')",
+ ],
+ )
+ def test_secure_transport_required_is_non_retryable(self, source, error_msg):
+ non_retryable = source.get_non_retryable_errors()
+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())
+ assert is_non_retryable, f"Secure-transport-required error should be non-retryable: {error_msg}"
+
@pytest.mark.parametrize(
"error_msg",
[