: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(mailgun): stop retrying when every sending domain rejects a table (#116079)
Tom Owersefa676a59d65
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/source.pyindex 35325bd4422e..2ba7535889c4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/source.py@@ -92,6 +92,10 @@ class MailgunSource("401 Client Error: Unauthorized for url: https://api.eu.mailgun.net": "Mailgun authentication failed. Please check your private API key and that the EU region is correct for your account.","403 Client Error: Forbidden for url: https://api.mailgun.net": "Mailgun denied access. Please check that your API key has the required permissions.","403 Client Error: Forbidden for url: https://api.eu.mailgun.net": "Mailgun denied access. Please check that your API key has the required permissions.",+ # Raised by get_rows when every sending domain on the account rejected a domain-scoped+ # endpoint (inactive/unverified domains, or a key without access to them) — retrying+ # hits the same domains with the same result.+ "request for every sending domain": "Mailgun rejected every sending domain on this account for this table. Check that your sending domains are active in Mailgun and that your API key can read them.",}@propertydiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun.pyindex eab027656d9d..34f9952d3860 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun.py@@ -328,6 +328,12 @@ class TestGetRows:assert isinstance(result.raised, MailgunAllDomainsSkippedError)assert "every sending domain" in str(result.raised)+ # This message must stay a stable, non-sensitive substring of get_non_retryable_errors,+ # or an account with every domain rejected gets retried instead of surfaced to the user.+ non_retryable_errors = MailgunSource().get_non_retryable_errors()+ matches = [message for pattern, message in non_retryable_errors.items() if pattern in str(result.raised)]+ assert len(matches) == 1+def test_domain_listing_401_still_raises(self):# A 401 on the /v4/domains listing is a global credential failure, not a single bad# domain — it must surface (and stay non-retryable) rather than be skipped per-domain.