diff --git a/connectors/src/connectors/zendesk/lib/sync_ticket.ts b/connectors/src/connectors/zendesk/lib/sync_ticket.ts index c23472e57064..2b28ee2eb465 100644 --- a/connectors/src/connectors/zendesk/lib/sync_ticket.ts +++ b/connectors/src/connectors/zendesk/lib/sync_ticket.ts @@ -175,7 +175,16 @@ ${metadata} Conversation: ${comments .map((comment) => { - const author = users.find((user) => user.id === comment.author_id); + let author; + try { + author = users.find((user) => user.id === comment.author_id); + } catch (e) { + logger.warn( + { connectorId, e, ...loggerArgs }, + "[Zendesk] Error finding the author of a comment." + ); + author = null; + } return ` [${new Date(Number(comment?.created_at)).toISOString()}] ${ author ? `${author.name} (${author.email})` : "Unknown User" diff --git a/connectors/src/connectors/zendesk/temporal/activities.ts b/connectors/src/connectors/zendesk/temporal/activities.ts index 07347973c438..93e9e26a08e1 100644 --- a/connectors/src/connectors/zendesk/temporal/activities.ts +++ b/connectors/src/connectors/zendesk/temporal/activities.ts @@ -433,7 +433,7 @@ export async function syncZendeskTicketBatchActivity({ return { hasMore: false, nextLink: "" }; } - const users = await zendeskApiClient.users.list(); + const users = (await zendeskApiClient.users.list()) || []; const comments = await concurrentExecutor( tickets,