: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(matomo): stop retrying an instance URL that answers not found (#103327)
Tom Owers210000830a24
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.pyindex 548bb8036256..37399e5bb512 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@@ -57,6 +57,14 @@ class MatomoSource(ResumableSource[MatomoSourceConfig, MatomoResumeConfig], Vali# 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.",+ # Every call goes to the one reporting endpoint, and Matomo answers a method it does+ # not know with a 200 error envelope, so a 404 means the instance URL points at+ # something that is not a Matomo instance, or at one that is gone. The URL is fixed+ # until the customer edits it, so every retry replays the same 404.+ "404 Client Error: Not Found for url": (+ "PostHog couldn't find a Matomo instance at the URL configured for this source. "+ "Check the instance URL, then reconnect."+ ),"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.pyindex 5b721f1959a9..17b7ae348584 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@@ -34,6 +34,15 @@ class TestMatomoSource:non_retryable_errors = self.source.get_non_retryable_errors()assert any(key in observed_error for key in non_retryable_errors)+ def test_instance_url_not_found_is_non_retryable_with_actionable_message(self):+ # Left unclassified, this is retried on every schedule and stored with the customer's host in it.+ error = "404 Client Error: Not Found for url: https://myorg.matomo.cloud/index.php"+ messages = [message for key, message in self.source.get_non_retryable_errors().items() if key in error]+ assert messages, "A missing Matomo instance should stop the sync with a message"+ assert messages[0] is not None+ assert "instance URL" in messages[0]+ assert "matomo.cloud" not in messages[0]+def test_non_retryable_errors_does_not_match_server_errors(self):non_retryable_errors = self.source.get_non_retryable_errors()error = "500 Server Error for url: https://myorg.matomo.cloud/index.php"