Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Sep 22, 2025

Resolves #18424

Summary by CodeRabbit

  • Bug Fixes

    • Workflow retrieval now safely handles empty or missing results, preventing runtime errors and ensuring stable summaries when HubSpot returns no data.
  • Chores

    • Updated the HubSpot workflow retrieval action to version 0.0.3.
    • Bumped the @pipedream/hubspot package version to 1.7.9.
    • No breaking changes; stability-focused update.

@vercel
Copy link

vercel bot commented Sep 22, 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 Sep 24, 2025 6:48pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 24, 2025 6:48pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

The HubSpot retrieve-workflows action version is incremented and its summary computation is made nil-safe; the HubSpot package version is bumped. No other functional changes are present.

Changes

Cohort / File(s) Summary
HubSpot Retrieve Workflows Action
components/hubspot/actions/retrieve-workflows/retrieve-workflows.mjs
Exported action version bumped 0.0.20.0.3; summary computation updated to use optional chaining and a default (e.g., response?.results?.length ?? 0) to avoid errors when results is undefined.
HubSpot Package Version
components/hubspot/package.json
Package version bumped @pipedream/hubspot 1.7.81.7.9; no functional changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant A as Retrieve Workflows Action
  participant H as HubSpot API

  U->>A: Invoke action
  A->>H: GET /workflows
  H-->>A: Response (may include `results` or omit it / return error)
  alt results present
    A->>A: summary = response?.results?.length ?? 0
    A-->>U: Return data + summary
  else results missing or undefined
    A->>A: summary = 0 (default)
    A-->>U: Return data/error without TypeError
  end
  note over A: Optional chaining prevents reading `length` of undefined
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws at bugs that hide,
In workflow fields where errors bide.
A nil-safe hop, a gentle cheer,
Versions bumped — the path is clear.
Hoppity fixes, tidy and quick! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The update adds optional chaining to avoid a TypeError and bumps the version, which prevents the immediate failure, but it does not implement logic to capture and surface the upstream error details as required by issue #18424. Please add error handling to capture and propagate the original upstream error when response.results is undefined so that the underlying error information is surfaced as intended by issue #18424.
Description Check ⚠️ Warning The description only contains a resolve statement and does not include the required “## WHY” section or any explanation of why the change is needed as specified in the repository template. Please expand the pull request description to include the “## WHY” section with context and reasoning for the bug fix according to the template.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Hubspot - bug fix to retrieve-workflows” accurately summarizes the main change as a bug fix to the Hubspot retrieve-workflows action, is concise, and does not include unrelated details or noise.
Out of Scope Changes Check ✅ Passed All modifications are directly related to the bug fix for the retrieve-workflows action and version bumps for the Hubspot component, with no unrelated code changes introduced.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18424

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f3b440 and 8275e84.

📒 Files selected for processing (1)
  • components/hubspot/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/hubspot/package.json
⏰ 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

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.

❤️ Share

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

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: 0

🧹 Nitpick comments (2)
components/hubspot/actions/retrieve-workflows/retrieve-workflows.mjs (2)

16-16: Defensive null checks and clearer summary.

Guard response as well, and avoid || for numeric 0. Also fix singular/plural.

Apply this diff:

-    $.export("$summary", `Successfully retrieved ${response.results?.length || 0} workflows`);
+    const count = Array.isArray(response?.results) ? response.results.length : 0;
+    $.export("$summary", `Successfully retrieved ${count} workflow${count === 1 ? "" : "s"}`);

12-18: Surface upstream errors in summary and preserve stack.

Wrap the call to expose HubSpot error details and avoid masking failures.

Apply this diff:

   async run({ $ }) {
-    const response = await this.hubspot.listWorkflows({
-      $,
-    });
-    $.export("$summary", `Successfully retrieved ${response.results?.length || 0} workflows`);
-    return response;
+    try {
+      const response = await this.hubspot.listWorkflows({ $ });
+      const count = Array.isArray(response?.results) ? response.results.length : 0;
+      $.export("$summary", `Successfully retrieved ${count} workflow${count === 1 ? "" : "s"}`);
+      return response;
+    } catch (err) {
+      const msg = err?.response?.data?.message || err?.message || "Unknown error";
+      $.export("$summary", `Failed to retrieve workflows: ${msg}`);
+      throw err;
+    }
   },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e80efa and 8cc85bc.

📒 Files selected for processing (2)
  • components/hubspot/actions/retrieve-workflows/retrieve-workflows.mjs (2 hunks)
  • components/hubspot/package.json (1 hunks)
⏰ 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). (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (2)
components/hubspot/package.json (1)

3-3: Patch version bump LGTM (1.7.7).

Appropriate patch-level increment for a bug fix; no further concerns.

components/hubspot/actions/retrieve-workflows/retrieve-workflows.mjs (1)

7-7: Action version bump LGTM (0.0.3).

Consistent with a non‑breaking bug fix.

lcaresia
lcaresia previously approved these changes Sep 23, 2025
@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit 5914a1b into master Sep 24, 2025
10 checks passed
@michelle0927 michelle0927 deleted the issue-18424 branch September 24, 2025 19:53
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] Hubspot, retrieve workflows: "Cannot read properties of undefined" prevent from reading the actual error

3 participants