: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(zoho_crm): recognize 401/403 with empty reason phrase as non-retryable (#128061)
Tom Owersbe801bc87ff0
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_error_contract.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_error_contract.pyindex 9e95b9ba7b55..5c0111fac42b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_error_contract.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_error_contract.py@@ -475,6 +475,10 @@ def test_allowlists_name_only_extracting_sources(allowlist: dict[str, Any]) -> N("Marketo", "Marketo authentication failed: status=401, body={}"),("Marketo", "Marketo authentication failed: status=401, path=/rest/v1/leads.json, body={}"),("Marketo", "Marketo authentication failed: no access token in response ({})"),+ # Zoho (and some other vendors, over HTTP/2) send no reason phrase on some responses, so+ # `requests.raise_for_status()` renders a blank one instead of "Unauthorized"/"Forbidden".+ ("ZohoCRM", "401 Client Error: for url: https://www.zohoapis.com/crm/v8/Leads?page=1"),+ ("ZohoCRM", "403 Client Error: for url: https://www.zohoapis.com/crm/v8/Notes?page=1"),],)def test_narrowed_keys_still_match_permanent_errors(name: str, message: str) -> None:diff --git a/products/warehouse_sources/sources/zoho_crm/source.py b/products/warehouse_sources/sources/zoho_crm/source.pyindex 508ac6d846a0..0a4f1967d1e3 100644--- a/products/warehouse_sources/sources/zoho_crm/source.py+++ b/products/warehouse_sources/sources/zoho_crm/source.py@@ -76,7 +76,11 @@ class ZohoCRMSource(ResumableSource[ZohoCRMSourceConfig, ZohoCRMResumeConfig]):# variant too, or the same credential rejection retries the whole activity budget."400 Client Error: for url: https://accounts.zoho": "Zoho CRM rejected your OAuth credentials. Check that the client ID, client secret, and refresh token all belong to the same self client.","401 Client Error: Unauthorized for url": "Your Zoho CRM access token is invalid or expired. Reconnect the source to issue a new one.",+ # Same reason-phrase gap as the blank 400 variant above — match it here too, or a+ # response with no reason phrase retries the whole activity budget before failing.+ "401 Client Error: for url": "Your Zoho CRM access token is invalid or expired. Reconnect the source to issue a new one.","403 Client Error: Forbidden for url": "Your Zoho CRM token is missing a scope for this module. Re-authorize with the ZohoCRM.modules.ALL, ZohoCRM.settings.fields.READ, and ZohoCRM.settings.modules.READ scopes.",+ "403 Client Error: for url": "Your Zoho CRM token is missing a scope for this module. Re-authorize with the ZohoCRM.modules.ALL, ZohoCRM.settings.fields.READ, and ZohoCRM.settings.modules.READ scopes.","Non-JSON response from": "Zoho CRM returned a non-JSON response, for example an HTML error or login page, instead of data. Check that the data center you picked matches your Zoho account, then try again.",}