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(matomo): stop retrying an expired instance certificate (#103556)

Tom Owers0dd7b14b3a92
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py
index bd8253668cbd..ce56a1720855 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/source.py
@@ -53,6 +53,10 @@ class MatomoSource(ResumableSource[MatomoSourceConfig, MatomoResumeConfig], Vali
return {
"401 Client Error: Unauthorized for url": "Matomo authentication failed. Please check your API token.",
"403 Client Error: Forbidden for url": "Matomo denied access. Please check your API token's permissions for this site.",
+ # The instance's own HTTPS certificate has expired. This is a problem with the
+ # customer's Matomo host, not PostHog's request, and every retry hits the same
+ # expired cert until they renew it.
+ "certificate has expired": "PostHog could not connect to your Matomo instance because its SSL certificate has expired. Renew the certificate on your Matomo host, then try again.",
"Matomo API error:": None,
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py
index 10c87ae520e2..dbdf604693a3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/matomo/tests/test_matomo_source.py
@@ -25,6 +25,9 @@ class TestMatomoSource:
"401 Client Error: Unauthorized for url: https://myorg.matomo.cloud/index.php",
"403 Client Error: Forbidden for url: https://myorg.matomo.cloud/index.php",
"Matomo API error: You can't access this resource",
+ "HTTPSConnectionPool(host='myorg.matomo.cloud', port=443): Max retries exceeded with url: "
+ "/index.php (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] "
+ "certificate verify failed: certificate has expired (_ssl.c:1032)')))",
],
)
def test_non_retryable_errors_match_known_failures(self, observed_error):