Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Nov 4, 2025

Resolves #18950

Summary by CodeRabbit

  • Chores
    • Bumped Zendesk component version (0.10.0 → 0.10.1) and updated multiple source module versions.
  • Improvements
    • Improved ticket field handling and webhook payload preparation for more reliable and consistent event data.

@vercel
Copy link

vercel bot commented Nov 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Nov 4, 2025 10:39pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 4, 2025 10:39pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is minimal but includes the issue reference (Resolves #18950). However, it does not follow the template with a WHY section explaining the rationale or context for the changes. Add a WHY section explaining the bug, the root cause, and why these specific changes fix the issue for better context and traceability.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: a bug fix for Zendesk to support fields without labels, which directly addresses the linked issue about undefined labels in convertToCamelCase.
Linked Issues check ✅ Passed The code changes address the linked issue #18950 by making getTriggerPayload async and updating field key derivation to safely handle undefined labels via fallback to field value and placeholder assignment.
Out of Scope Changes check ✅ Passed All changes are scoped to the Zendesk component with version bumps and async method updates directly related to supporting fields without labels. No unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18950

Comment @coderabbitai help to get the list of available commands and usage tips.

@michelle0927 michelle0927 marked this pull request as ready for review November 4, 2025 22:32
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7dfc85b and cc3ede4.

📒 Files selected for processing (10)
  • components/zendesk/package.json (1 hunks)
  • components/zendesk/sources/common/ticket.mjs (2 hunks)
  • components/zendesk/sources/common/webhook.mjs (3 hunks)
  • components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs (2 hunks)
  • components/zendesk/sources/new-ticket/new-ticket.mjs (1 hunks)
  • components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs (1 hunks)
  • components/zendesk/sources/ticket-closed/ticket-closed.mjs (1 hunks)
  • components/zendesk/sources/ticket-pended/ticket-pended.mjs (1 hunks)
  • components/zendesk/sources/ticket-solved/ticket-solved.mjs (1 hunks)
  • components/zendesk/sources/ticket-updated/ticket-updated.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.

Applied to files:

  • components/zendesk/sources/common/ticket.mjs
🧬 Code graph analysis (2)
components/zendesk/sources/common/ticket.mjs (1)
components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs (2)
  • key (73-76)
  • payload (54-54)
components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs (1)
components/zendesk/sources/common/ticket.mjs (1)
  • payload (19-23)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (14)
components/zendesk/sources/ticket-updated/ticket-updated.mjs (1)

9-9: LGTM - Version bump is consistent.

The version increment aligns with the broader package update and bug fix in the common ticket module.

components/zendesk/package.json (1)

3-3: LGTM - Appropriate patch version increment.

The version bump from 0.10.0 to 0.10.1 correctly reflects a bug fix release.

components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs (1)

8-8: LGTM - Version bump is consistent.

components/zendesk/sources/ticket-pended/ticket-pended.mjs (1)

9-9: LGTM - Version bump is consistent.

components/zendesk/sources/new-ticket/new-ticket.mjs (1)

9-9: LGTM - Version bump is consistent.

components/zendesk/sources/ticket-solved/ticket-solved.mjs (1)

9-9: LGTM - Version bump is consistent.

components/zendesk/sources/ticket-closed/ticket-closed.mjs (1)

9-9: LGTM - Version bump is consistent.

components/zendesk/sources/common/ticket.mjs (2)

14-17: LGTM - Async conversion is appropriate.

Converting getTriggerPayload to async is necessary to fetch custom ticket fields. The early return for jsonBody parsing is correctly preserved.


24-24: LGTM - Fetching custom fields for dynamic payload.

Retrieving ticket field metadata enables dynamic placeholder generation for fields without explicit values.

components/zendesk/sources/common/webhook.mjs (3)

60-63: LGTM!

The async call to setupTriggerData is properly awaited within the async activate hook.


174-193: No issues found – async change is properly implemented and handled.

The async signature change at line 174 is correct and justified. The caller at line 60 properly awaits setupTriggerData(). The field metadata fetching and label handling fallback logic are correctly implemented in the getTriggerPayload() method in common/ticket.mjs (lines 24-32), which fetches custom fields and applies the fallback pattern field?.label || field to handle missing labels.


187-187: ****

The original review concern is not valid. All components extending the webhook base properly implement getTriggerPayload as async functions:

  • ticket.mjs: Overrides with async getTriggerPayload()
  • Sources extending ticket.mjs (new-ticket, ticket-added-to-view, ticket-closed, ticket-pended, ticket-solved, ticket-updated): Inherit async implementation
  • new-ticket-comment-added.mjs: Overrides with async getTriggerPayload() and calls await common.methods.getTriggerPayload.call(this)
  • locale-updated.mjs: Uses polling.mjs (completely separate), never calls getTriggerPayload

The base class throws an error on getTriggerPayload(), enforcing that all implementations must override it. The await at line 187 is safe—it's only executed on instances with proper async implementations.

Likely an incorrect or invalid review comment.

components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs (2)

53-59: No issues found. Code is correct.

The verification confirms that common.methods.getTriggerPayload in components/zendesk/sources/common/ticket.mjs is correctly defined as async (line 14), making the await at line 54 of the new-ticket-comment-added.mjs file appropriate and consistent. The implementation properly handles async parent calls and correctly merges the payload with the ticketComments field.


10-10: Review comment is partially valid; no undefined property fix is visible in this file.

The version bump to 0.1.1 aligns with the visible change: making getTriggerPayload async (line 33 now uses await). However, the undefined error mentioned in PR objectives is not addressed here. The code at components/zendesk/sources/common/ticket.mjs:26 already handles undefined labels via field?.label || field fallback. Either the fix is in a different file or the PR objectives may describe a separate concern.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
components/zendesk/sources/common/ticket.mjs (1)

26-26: Add explicit type validation before calling convertToCamelCase.

The fix field?.label || field addresses the immediate bug for string fields, but doesn't handle all edge cases. If field is null, undefined, or an object without a label property, the fallback could pass non-string values to convertToCamelCase(), causing .replace() to fail on line 8.

Add type validation to ensure a string is always passed:

-        const key = this.convertToCamelCase(field?.label || field);
+        const labelOrField = typeof field === "object" && field?.label 
+          ? field.label 
+          : field;
+        if (!labelOrField || typeof labelOrField !== "string") {
+          console.warn(`Invalid field type: ${JSON.stringify(field)}`);
+          continue;
+        }
+        const key = this.convertToCamelCase(labelOrField);

Alternatively, for a more compact solution that normalizes to string:

-        const key = this.convertToCamelCase(field?.label || field);
+        const labelOrField = (typeof field === "object" ? field?.label : field) || "";
+        if (!labelOrField) continue;
+        const key = this.convertToCamelCase(labelOrField);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc3ede4 and 02f0885.

📒 Files selected for processing (1)
  • components/zendesk/sources/common/ticket.mjs (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.

Applied to files:

  • components/zendesk/sources/common/ticket.mjs
📚 Learning: 2025-08-27T17:25:10.425Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 18187
File: packages/connect-react/src/utils/type-guards.ts:23-33
Timestamp: 2025-08-27T17:25:10.425Z
Learning: In the connect-react package, the isOptionWithLabel type guard intentionally restricts value types to string|number for runtime filtering purposes, even though LabelValueOption<T> allows any T. This runtime behavior should be preserved over type safety improvements.

Applied to files:

  • components/zendesk/sources/common/ticket.mjs
📚 Learning: 2024-10-08T16:42:59.225Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14229
File: components/americommerce/actions/update-customer/update-customer.mjs:89-94
Timestamp: 2024-10-08T16:42:59.225Z
Learning: When defining boolean properties in AmeriCommerce components (e.g., in `update-customer.mjs`), ensure that the label and description are consistent and clearly indicate the intent, especially when using negations like "No Account", to avoid confusion.

Applied to files:

  • components/zendesk/sources/common/ticket.mjs
🧬 Code graph analysis (1)
components/zendesk/sources/common/ticket.mjs (2)
components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs (2)
  • key (73-76)
  • payload (54-54)
components/zendesk/sources/common/webhook.mjs (1)
  • payload (226-230)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (1)
components/zendesk/sources/common/ticket.mjs (1)

14-14: LGTM! Async promotion is necessary and correctly propagated.

The method is correctly made async to support awaiting listTicketFields() on line 24. The callers have been updated to await this method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Zendesk Source exception thrown

2 participants