-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[connectors] Fix(Zendesk) - users not found #8912
Conversation
@@ -427,7 +427,7 @@ export async function syncZendeskTicketBatchActivity({ | |||
return { hasMore: false, nextLink: "" }; | |||
} | |||
|
|||
const users = await zendeskApiClient.users.list(); | |||
const users = (await zendeskApiClient.users.list()) || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can .list()
return undefined ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not in the types, yes in the actual implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're not fond of trycatch here :P
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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; | |
} | |
const author = users?.find((user) => user?.id === comment?.author_id) || null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's not really what we're trying to fix with our try catch, will safely ignore for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah actually not sure what this is supposed to do ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there's an error here then it's a typescript error no ? there's no async at all
* fix: fix issues with users not found by the SDK * fix: ignore issues with users not found by the SDK * 🔊
Description
Risk
Low.
Deploy Plan