: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(supabase): explain a truncated certificate authority during setup (#123839)
Tom Owersf5a7d084f378
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 0828fa3356e5..0a2e0b52c8d8 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@@ -28,6 +28,12 @@ TLS_CONFIGURATION_ERRORS: dict[str, str | None] = {ENCRYPTED_CLIENT_KEY_ERROR: None,}+_INVALID_CA_CERTIFICATE_ERROR = (+ "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."+)+_CLIENT_CERTIFICATE_REJECTED_ERROR = ("Your database rejected the client certificate, or requires one. Add a client certificate and key that ""your database trusts."@@ -54,11 +60,10 @@ CERTIFICATE_ERRORS: dict[str, str] = {# 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."- ),+ "no certificate or crl found": _INVALID_CA_CERTIFICATE_ERROR,+ # libpq words every unreadable CA file this way, whatever OpenSSL's reason is (a truncated+ # certificate reports "bad end line", not the reason above).+ "could not read root certificate file": _INVALID_CA_CERTIFICATE_ERROR,}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 663af5ddb6b0..391dbb002184 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@@ -5750,6 +5750,14 @@ class TestValidateCredentialsErrorMapping:"host to the hostname your database provider gave you, or connect directly instead ""of through an SSH tunnel, then try again.",),+ # A truncated certificate authority. 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": bad end line',+ "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.",+ ),# Unmapped errors fall back to the generic message.("some brand new failure",