: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(redshift): treat non-SSL server connection as non-retryable (#66673)
Tom Owers39d5d4336ed5
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.pyindex 6568fd952594..f38786e931a7 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@@ -40,6 +40,7 @@ RedshiftErrors = {'database "': "Database does not exist","timeout expired": "Connection timed out. Does your database have our IP addresses allowed?","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.",}@@ -143,6 +144,7 @@ class RedshiftSource(SQLSource[RedshiftSourceConfig], SSHTunnelMixin, ValidateDa"No primary key defined for table": None,"failed: timeout expired": None,"SSL connection has been closed unexpectedly": None,+ "server does not support SSL": None,"does not exist": None,"QueryTimeoutException": None,"TemporaryFileSizeExceedsLimitException": None,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.py b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.pyindex bd57b85019f4..0e34c36a1ea3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.py@@ -827,6 +827,42 @@ class TestRedshiftSourceNonRetryableErrors:is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())assert is_non_retryable+ def test_ssl_server_error_is_non_retryable(self):+ error_msg = (+ 'connection failed: connection to server at "10.0.0.1", port 5439 failed: '+ "server does not support SSL, but SSL was required"+ )+ non_retryable = RedshiftSource().get_non_retryable_errors()+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())+ assert is_non_retryable+++class TestRedshiftValidateCredentials:+ def test_server_without_ssl_returns_friendly_error_without_capturing(self, mocker):+ # We always connect with sslmode=require, so a server that doesn't support SSL is a+ # host/port misconfiguration on the customer's side — surface guidance, don't report it.+ config = _make_config()+ source = RedshiftSource()+ mocker.patch.object(source, "ssh_tunnel_is_valid", return_value=(True, None))+ mocker.patch.object(source, "is_database_host_valid", return_value=(True, None))+ mocker.patch.object(+ source,+ "get_schemas",+ side_effect=psycopg.OperationalError(+ 'connection failed: connection to server at "10.0.0.1", port 5439 failed: '+ "server does not support SSL, but SSL was required"+ ),+ )+ capture = mocker.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.redshift.source.capture_exception"+ )++ ok, error = source.validate_credentials(config, team_id=1)++ assert ok is False+ assert error is not None and "does not support SSL" in error+ capture.assert_not_called()+class TestRedshiftSourceForPipeline:def test_forwards_chunk_size_override_from_external_data_schema(self, mocker):