: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(postgres): stop retrying an invalid CA certificate (#123541)
Tom Owersb7b9905fb548
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/tls.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/tls.pyindex 4655a73e905b..0828fa3356e5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/tls.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/tls.py@@ -51,6 +51,14 @@ CERTIFICATE_ERRORS: dict[str, str] = {# Postgres completes the TLS handshake and then rejects the certificate at its pg_hba check."certificate authentication failed": _CLIENT_CERTIFICATE_REJECTED_ERROR,"connection requires a valid client certificate": _CLIENT_CERTIFICATE_REJECTED_ERROR,+ # libpq fails to load the file `tls_files` wrote for the "Certificate authority" field when its+ # content isn't a parseable PEM certificate (empty, truncated, or not a certificate at all). The+ # raw message also names the per-run temp file path, so match the stable OpenSSL reason instead.+ "no certificate or crl found": (+ "The certificate authority you configured isn't a valid PEM certificate. Paste the complete "+ "certificate (including the BEGIN/END lines), or remove it and turn off certificate "+ "verification instead."+ ),}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.pyindex 1a0ad66c4906..2503f0e07810 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py@@ -499,6 +499,10 @@ class TestPostgresSourceNonRetryableErrors:# A serverless provider refuses every connect while the branch is hibernated, until the# customer reactivates it. Host and IP are invented, not real values.'connection failed: connection to server at "203.0.113.7", port 5432 failed: FATAL: branch is hibernated, reactivate it to continue',+ # The "Certificate authority" field holds a value that isn't a parseable PEM certificate,+ # so libpq can't load the file `tls_files` wrote for it. Permanent until the customer+ # fixes the field. Host and temp path are invented, not real values.+ 'connection failed: connection to server at "203.0.113.7", port 5432 failed: could not read root certificate file "/tmp/source-tls-xxxxxxxx/ca.crt": no certificate or crl found',],)def test_permanent_connection_errors_are_non_retryable(self, source, error_msg):