From e080271c9cab90b017d324182871b650a7ea3b5f Mon Sep 17 00:00:00 2001 From: Aubin <60398825+aubin-tchoi@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:58:45 +0100 Subject: [PATCH] fix: handle 404 by returning null objects instead of crashing (#8822) --- connectors/src/connectors/zendesk/lib/zendesk_api.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/connectors/src/connectors/zendesk/lib/zendesk_api.ts b/connectors/src/connectors/zendesk/lib/zendesk_api.ts index 98fb63987c0d..4ff48fdf55cd 100644 --- a/connectors/src/connectors/zendesk/lib/zendesk_api.ts +++ b/connectors/src/connectors/zendesk/lib/zendesk_api.ts @@ -134,6 +134,13 @@ async function fetchFromZendeskWithRetries({ try { response = await rawResponse.json(); } catch (e) { + if (rawResponse.status === 404) { + logger.error( + { rawResponse, text: rawResponse.text }, + "[Zendesk] Zendesk API 404 error" + ); + return null; + } logger.error( { rawResponse, status: rawResponse.status, text: rawResponse.text }, "[Zendesk] Error parsing Zendesk API response"