[20714] fix(zoho_desk): handle missing errors array in makeRequest - #20820
Conversation
- Add optional-chaining on errors array - Add static fallback error message - Patch-bump versions for zoho-desk component and all its actions & sources
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR updates the Zoho Desk component to v0.5.1: it increments version metadata for many actions and sources, bumps the package.json version, and improves error-message selection in makeRequest with prioritized fallbacks. ChangesZoho Desk Release Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (9)
components/zoho_desk/actions/create-ticket/create-ticket.mjs (1)
161-166:⚠️ Potential issue | 🟠 Major | ⚡ Quick winPass
$intocreateTicketapp method call.
This action calls an app HTTP helper without$, which breaks the standard request-context pattern used for platform logging/error propagation.Suggested fix
const response = await this.zohoDesk.createTicket({ + $, headers: { orgId, }, data, });As per coding guidelines, “when actions delegate to app methods, pass the
$context into app HTTP helpers.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/create-ticket/create-ticket.mjs` around lines 161 - 166, The createTicket call is missing the platform request context ($); update the this.zohoDesk.createTicket invocation to pass the $ context (e.g., this.zohoDesk.createTicket($, { headers: { orgId }, data })) so the app HTTP helper receives the request context for logging/error propagation and follows the action-to-app method pattern.components/zoho_desk/sources/new-ticket-attachment/new-ticket-attachment.mjs (1)
71-74:⚠️ Potential issue | 🟠 Major | ⚡ Quick winInclude
$when calling the app request helper.
makeRequestis invoked without request context, which can reduce consistency in request tracing/error handling.Suggested fix
const response = await this.zohoDesk.makeRequest({ + $: this, url: resource.href, responseType: "arraybuffer", });As per coding guidelines, “when those methods use
@pipedream/platformaxios internally, the$context … must be passed to them.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/sources/new-ticket-attachment/new-ticket-attachment.mjs` around lines 71 - 74, Call the app helper with the Pipedream request context by passing this.$ as the first argument to this.zohoDesk.makeRequest so tracing/error handling works correctly; i.e., update the call that currently invokes this.zohoDesk.makeRequest({ url: resource.href, responseType: "arraybuffer" }) to pass this.$ as the first parameter while keeping url: resource.href and responseType: "arraybuffer".components/zoho_desk/actions/update-contact/update-contact.mjs (2)
109-115:⚠️ Potential issue | 🟠 Major | ⚡ Quick winMissing
$context parameter in app method call.The
updateContactmethod call should receive the$context to enable request logging and proper error propagation. The$parameter fromrun({ $ })must be passed to app methods that use the@pipedream/platformaxios helper.As per coding guidelines: "when those methods use
@pipedream/platformaxios internally, the$context fromrun({ $ })must be passed to them — it enables request logging and error propagation; flag any app method call that omits$."🔧 Proposed fix
const response = await this.zohoDesk.updateContact({ + $, contactId, headers: { orgId, }, data, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/update-contact/update-contact.mjs` around lines 109 - 115, The call to this.zohoDesk.updateContact is missing the `$` context from run({ $ }), so request logging and error propagation won't work; update the invocation of updateContact to pass the `$` parameter (the same $ received in run({ $ })) along with contactId, headers, and data so the `@pipedream/platform` axios helper can use the context for logging and error handling.
99-107: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider simplifying optional field handling.
The explicit truthiness checks for optional fields are unnecessary since
@pipedream/platformaxios automatically stripsundefinedvalues from request bodies. You can pass the properties directly to the data object.As per coding guidelines: "Optional props may be passed directly into request bodies or params without truthiness checks —
@pipedream/platformaxios strips undefined values automatically."♻️ Proposed refactor
- const data = {}; - - // Add optional fields - if (lastName) data.lastName = lastName; - if (firstName) data.firstName = firstName; - if (email) data.email = email; - if (phone) data.phone = phone; - if (mobile) data.mobile = mobile; - if (accountId) data.accountId = accountId; - if (title) data.title = title; - if (description) data.description = description; + const data = { + lastName, + firstName, + email, + phone, + mobile, + accountId, + title, + description, + }; const response = await this.zohoDesk.updateContact({🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/update-contact/update-contact.mjs` around lines 99 - 107, The optional-field checks in update-contact.mjs (the block that mutates the data object with lastName, firstName, email, phone, mobile, accountId, title, description) are unnecessary; remove the individual if (field) checks and instead assign the optional props directly into the request body (e.g., build or extend the data object with the properties lastName, firstName, email, phone, mobile, accountId, title, description) because `@pipedream/platform` axios will strip undefined values automatically—update the code that constructs the data object referenced in this diff accordingly.components/zoho_desk/actions/list-ticket-comments/list-ticket-comments.mjs (1)
52-54: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider simplifying optional parameter handling.
The explicit truthiness checks for optional parameters are unnecessary since
@pipedream/platformaxios automatically stripsundefinedvalues. You can pass the properties directly to the params object.As per coding guidelines: "Optional props may be passed directly into request bodies or params without truthiness checks —
@pipedream/platformaxios strips undefined values automatically."♻️ Proposed refactor
- const params = {}; - if (from) params.from = from; - if (limit) params.limit = limit; + const params = { + from, + limit, + }; const response = await this.zohoDesk.getTicketComments({🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/list-ticket-comments/list-ticket-comments.mjs` around lines 52 - 54, The params object in list-ticket-comments currently builds properties conditionally using truthiness checks for from and limit; simplify by directly assigning these optional props to params (e.g., params = { from, limit, ... } or include them when constructing the request) because `@pipedream/platform` axios will strip undefined values automatically—remove the if (from) and if (limit) branches and pass from and limit directly into the params used by the request.components/zoho_desk/actions/list-ticket-threads/list-ticket-threads.mjs (2)
59-61: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider simplifying optional parameter handling.
The explicit truthiness checks for optional parameters are unnecessary since
@pipedream/platformaxios automatically stripsundefinedvalues.As per coding guidelines: "Optional props may be passed directly into request bodies or params without truthiness checks —
@pipedream/platformaxios strips undefined values automatically."♻️ Proposed refactor
- const params = {}; - if (from) params.from = from; - if (limit) params.limit = limit; + const params = { + from, + limit, + }; const response = await this.zohoDesk.getTicketThreads({🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/list-ticket-threads/list-ticket-threads.mjs` around lines 59 - 61, Remove the explicit truthiness checks when building the params object in list-ticket-threads action: instead of conditionally setting params.from and params.limit, assign both properties directly on the params object (e.g., params = { from, limit }) so undefined values are passed through and automatically stripped by `@pipedream/platform` axios; update the code that references the params variable in the request to use the simplified params object.
74-80:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winAdd
orgIdheader togetThreadDetailscall on line 76.The
getThreadDetailscall is missing theorgIdheader required by the Zoho Desk API. All other calls to this method—inget-thread-details.mjs,download-thread-attachment.mjs, and within the app file—include it. Without it, the method will fail whenincludeFullContentis enabled.Pass `orgId` in the headers object:
return await this.zohoDesk.getThreadDetails({ $, ticketId, threadId: thread.id, headers: { orgId, }, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/list-ticket-threads/list-ticket-threads.mjs` around lines 74 - 80, The call to this.zohoDesk.getThreadDetails (inside the threads Promise.all mapping) is missing the required orgId header; update the getThreadDetails invocation (the function that currently passes $, ticketId, threadId: thread.id) to include a headers object with orgId (e.g., add headers: { orgId }) so the Zoho Desk API receives the organization ID when includeFullContent is enabled.components/zoho_desk/actions/find-or-create-contact/find-or-create-contact.mjs (1)
9-13:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
readOnlyHintmust befalsefor find-or-create behavior.This action can create a contact, so it is not read-only.
Suggested fix
annotations: { destructiveHint: false, openWorldHint: true, - readOnlyHint: true, + readOnlyHint: false, },As per coding guidelines,
readOnlyHint: trueis valid only when an action exclusively reads data with no side effects.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/find-or-create-contact/find-or-create-contact.mjs` around lines 9 - 13, The annotations for the find-or-create contact action incorrectly mark it as read-only; update the annotations object in find-or-create-contact.mjs so readOnlyHint is set to false (change the annotations property where readOnlyHint: true is declared) because the action can create contacts and thus has side effects.components/zoho_desk/actions/update-ticket/update-ticket.mjs (1)
9-13:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winSet
destructiveHinttofalsefor update operations.This action updates a ticket and is generally reversible, so
destructiveHint: trueis misleading.Suggested fix
annotations: { - destructiveHint: true, + destructiveHint: false, openWorldHint: true, readOnlyHint: false, },As per coding guidelines,
destructiveHint: trueis reserved for permanently destructive operations, while update/patch operations are generallyfalse.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zoho_desk/actions/update-ticket/update-ticket.mjs` around lines 9 - 13, The annotations block in the update-ticket.mjs action incorrectly sets destructiveHint: true; change the annotations object's destructiveHint property to false since this is an update/patch action (locate the annotations object in update-ticket.mjs and update the destructiveHint value), leaving openWorldHint and readOnlyHint unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/zoho_desk/actions/update-contact/update-contact.mjs`:
- Line 10: The action metadata for the update-contact action incorrectly marks
the operation as destructive; change the destructiveHint property from true to
false in the update-contact action definition so the update/patch operation is
not flagged as destructive (locate the object containing the destructiveHint
property in the update-contact action and set destructiveHint: false).
---
Outside diff comments:
In `@components/zoho_desk/actions/create-ticket/create-ticket.mjs`:
- Around line 161-166: The createTicket call is missing the platform request
context ($); update the this.zohoDesk.createTicket invocation to pass the $
context (e.g., this.zohoDesk.createTicket($, { headers: { orgId }, data })) so
the app HTTP helper receives the request context for logging/error propagation
and follows the action-to-app method pattern.
In
`@components/zoho_desk/actions/find-or-create-contact/find-or-create-contact.mjs`:
- Around line 9-13: The annotations for the find-or-create contact action
incorrectly mark it as read-only; update the annotations object in
find-or-create-contact.mjs so readOnlyHint is set to false (change the
annotations property where readOnlyHint: true is declared) because the action
can create contacts and thus has side effects.
In `@components/zoho_desk/actions/list-ticket-comments/list-ticket-comments.mjs`:
- Around line 52-54: The params object in list-ticket-comments currently builds
properties conditionally using truthiness checks for from and limit; simplify by
directly assigning these optional props to params (e.g., params = { from, limit,
... } or include them when constructing the request) because `@pipedream/platform`
axios will strip undefined values automatically—remove the if (from) and if
(limit) branches and pass from and limit directly into the params used by the
request.
In `@components/zoho_desk/actions/list-ticket-threads/list-ticket-threads.mjs`:
- Around line 59-61: Remove the explicit truthiness checks when building the
params object in list-ticket-threads action: instead of conditionally setting
params.from and params.limit, assign both properties directly on the params
object (e.g., params = { from, limit }) so undefined values are passed through
and automatically stripped by `@pipedream/platform` axios; update the code that
references the params variable in the request to use the simplified params
object.
- Around line 74-80: The call to this.zohoDesk.getThreadDetails (inside the
threads Promise.all mapping) is missing the required orgId header; update the
getThreadDetails invocation (the function that currently passes $, ticketId,
threadId: thread.id) to include a headers object with orgId (e.g., add headers:
{ orgId }) so the Zoho Desk API receives the organization ID when
includeFullContent is enabled.
In `@components/zoho_desk/actions/update-contact/update-contact.mjs`:
- Around line 109-115: The call to this.zohoDesk.updateContact is missing the
`$` context from run({ $ }), so request logging and error propagation won't
work; update the invocation of updateContact to pass the `$` parameter (the same
$ received in run({ $ })) along with contactId, headers, and data so the
`@pipedream/platform` axios helper can use the context for logging and error
handling.
- Around line 99-107: The optional-field checks in update-contact.mjs (the block
that mutates the data object with lastName, firstName, email, phone, mobile,
accountId, title, description) are unnecessary; remove the individual if (field)
checks and instead assign the optional props directly into the request body
(e.g., build or extend the data object with the properties lastName, firstName,
email, phone, mobile, accountId, title, description) because `@pipedream/platform`
axios will strip undefined values automatically—update the code that constructs
the data object referenced in this diff accordingly.
In `@components/zoho_desk/actions/update-ticket/update-ticket.mjs`:
- Around line 9-13: The annotations block in the update-ticket.mjs action
incorrectly sets destructiveHint: true; change the annotations object's
destructiveHint property to false since this is an update/patch action (locate
the annotations object in update-ticket.mjs and update the destructiveHint
value), leaving openWorldHint and readOnlyHint unchanged.
In
`@components/zoho_desk/sources/new-ticket-attachment/new-ticket-attachment.mjs`:
- Around line 71-74: Call the app helper with the Pipedream request context by
passing this.$ as the first argument to this.zohoDesk.makeRequest so
tracing/error handling works correctly; i.e., update the call that currently
invokes this.zohoDesk.makeRequest({ url: resource.href, responseType:
"arraybuffer" }) to pass this.$ as the first parameter while keeping url:
resource.href and responseType: "arraybuffer".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1eb813aa-1a2b-4c98-b4dd-401c9b04cdca
📒 Files selected for processing (42)
components/zoho_desk/actions/add-ticket-attachment/add-ticket-attachment.mjscomponents/zoho_desk/actions/add-ticket-comment/add-ticket-comment.mjscomponents/zoho_desk/actions/create-account/create-account.mjscomponents/zoho_desk/actions/create-contact/create-contact.mjscomponents/zoho_desk/actions/create-ticket/create-ticket.mjscomponents/zoho_desk/actions/delete-ticket-comment/delete-ticket-comment.mjscomponents/zoho_desk/actions/download-thread-attachment/download-thread-attachment.mjscomponents/zoho_desk/actions/find-contact/find-contact.mjscomponents/zoho_desk/actions/find-or-create-contact/find-or-create-contact.mjscomponents/zoho_desk/actions/get-article/get-article.mjscomponents/zoho_desk/actions/get-thread-details/get-thread-details.mjscomponents/zoho_desk/actions/get-ticket-comment-history/get-ticket-comment-history.mjscomponents/zoho_desk/actions/get-ticket-comment/get-ticket-comment.mjscomponents/zoho_desk/actions/get-ticket-details/get-ticket-details.mjscomponents/zoho_desk/actions/list-articles/list-articles.mjscomponents/zoho_desk/actions/list-conversations/list-conversations.mjscomponents/zoho_desk/actions/list-help-centers/list-help-centers.mjscomponents/zoho_desk/actions/list-root-categories/list-root-categories.mjscomponents/zoho_desk/actions/list-ticket-attachments/list-ticket-attachments.mjscomponents/zoho_desk/actions/list-ticket-comments/list-ticket-comments.mjscomponents/zoho_desk/actions/list-ticket-threads/list-ticket-threads.mjscomponents/zoho_desk/actions/list-tickets/list-tickets.mjscomponents/zoho_desk/actions/search-articles/search-articles.mjscomponents/zoho_desk/actions/search-ticket/search-ticket.mjscomponents/zoho_desk/actions/send-email-reply/send-email-reply.mjscomponents/zoho_desk/actions/update-contact/update-contact.mjscomponents/zoho_desk/actions/update-ticket-comment/update-ticket-comment.mjscomponents/zoho_desk/actions/update-ticket/update-ticket.mjscomponents/zoho_desk/package.jsoncomponents/zoho_desk/sources/changed-ticket-status/changed-ticket-status.mjscomponents/zoho_desk/sources/deleted-article-instant/deleted-article-instant.mjscomponents/zoho_desk/sources/new-account/new-account.mjscomponents/zoho_desk/sources/new-agent/new-agent.mjscomponents/zoho_desk/sources/new-article-instant/new-article-instant.mjscomponents/zoho_desk/sources/new-contact/new-contact.mjscomponents/zoho_desk/sources/new-ticket-attachment/new-ticket-attachment.mjscomponents/zoho_desk/sources/new-ticket-comment/new-ticket-comment.mjscomponents/zoho_desk/sources/new-ticket-message/new-ticket-message.mjscomponents/zoho_desk/sources/new-ticket/new-ticket.mjscomponents/zoho_desk/sources/updated-article-instant/updated-article-instant.mjscomponents/zoho_desk/sources/updated-ticket/updated-ticket.mjscomponents/zoho_desk/zoho_desk.app.mjs
michelle0927
left a comment
There was a problem hiding this comment.
LGTM! Ready for QA!
…ipedreamHQ#20820) * [20714] fix(zoho_desk): handle missing errors array in makeRequest - Add optional-chaining on errors array - Add static fallback error message - Patch-bump versions for zoho-desk component and all its actions & sources * set destructiveHint false --------- Co-authored-by: Michelle Bergeron <michelle.bergeron@gmail.com>
…20820) * [20714] fix(zoho_desk): handle missing errors array in makeRequest - Add optional-chaining on errors array - Add static fallback error message - Patch-bump versions for zoho-desk component and all its actions & sources * set destructiveHint false --------- Co-authored-by: Michelle Bergeron <michelle.bergeron@gmail.com>

Summary
Closes issue #20714
Video displaying
before&after:zoho-desk-error-test_blurred.mp4
Checklist
Please check the following items before your PR can be reviewed:
Versioning
0.0.1for new ones)package.json's version updatedNew app
If this is a new app, please submit an app integration request - the PR will only be reviewed after the app is integrated.
CodeRabbit review
After the PR is opened, and if new changes are pushed, CodeRabbit will automatically review it. Do not 'mark as resolved' CodeRabbit's comments, but reply to them instead, whether you agree (and update the PR accordingly) or disagree.
Summary by CodeRabbit
Bug Fixes
Chores