Skip to content

Hubspot - Search CRM #15417

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

Merged
merged 9 commits into from
Feb 5, 2025
Merged

Hubspot - Search CRM #15417

merged 9 commits into from
Feb 5, 2025

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jan 27, 2025

Resolves #15403

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling for CRM search operations to prevent invalid search properties.
  • Chores
    • Updated package version from 0.13.1 to 0.13.3.
    • Updated component version from 0.0.11 to 0.0.13.
    • Minor formatting updates across various components (newline additions).

Copy link

vercel bot commented Jan 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Feb 5, 2025 6:22pm
pipedream-docs ⬜️ Ignored (Inspect) Feb 5, 2025 6:22pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Feb 5, 2025 6:22pm

Copy link
Contributor

coderabbitai bot commented Jan 27, 2025

Walkthrough

This pull request introduces modifications to the Hubspot Search CRM action, specifically enhancing error handling in the search-crm.mjs file. It includes a new import for ConfigurationError, an increment in the version from "0.0.11" to "0.0.13", and the addition of schema retrieval and validation for the searchProperty. Additionally, the version of the @pipedream/hubspot package has been updated from "0.13.1" to "0.13.3".

Changes

File Change Summary
components/hubspot/actions/search-crm/search-crm.mjs - Added import for ConfigurationError
- Updated version from "0.0.11" to "0.0.13"
- Added schema retrieval and validation for searchProperty
components/hubspot/package.json - Updated package version from "0.13.1" to "0.13.3"
components/*/*.mjs - Added newline at the end of the file for multiple components (adobe_document_generation_api, browserbase, buysellads, humanlayer, instant, klipy, lightpanda, planhat, storerocket, synthflow)

Assessment against linked issues

Objective Addressed Explanation
Fix 400 BAD REQUEST error for Contacts and Companies search

Possibly related PRs

  • Zoho CRM - support picklist fields #14974: The changes in the main PR are related to the error handling improvements and the introduction of ConfigurationError, which is also utilized in the retrieved PR's modifications to the update-object.mjs file.
  • Hubspot new task version fix #15216: The changes in the main PR are related to the version updates in the package.json and search-crm.mjs files, while the retrieved PR also involves a version update in the package.json and a different file, indicating a connection through version management.

Suggested labels

User submitted, ai-assisted

Suggested reviewers

  • GTFalcao

Poem

🐰 A rabbit's tale of code so bright,
Hubspot search now validates with might!
Properties checked with care and grace,
No more errors in this coding space.
Version bumped, the bug takes flight! 🚀

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 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 2f1db94 and c1fa77c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • components/adobe_document_generation_api/adobe_document_generation_api.app.mjs (1 hunks)
  • components/browserbase/browserbase.app.mjs (1 hunks)
  • components/buysellads/buysellads.app.mjs (1 hunks)
  • components/humanlayer/humanlayer.app.mjs (1 hunks)
  • components/instant/instant.app.mjs (1 hunks)
  • components/klipy/klipy.app.mjs (1 hunks)
  • components/lightpanda/lightpanda.app.mjs (1 hunks)
  • components/planhat/planhat.app.mjs (1 hunks)
  • components/storerocket/storerocket.app.mjs (1 hunks)
  • components/synthflow/synthflow.app.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (10)
  • components/synthflow/synthflow.app.mjs
  • components/adobe_document_generation_api/adobe_document_generation_api.app.mjs
  • components/lightpanda/lightpanda.app.mjs
  • components/storerocket/storerocket.app.mjs
  • components/instant/instant.app.mjs
  • components/klipy/klipy.app.mjs
  • components/buysellads/buysellads.app.mjs
  • components/planhat/planhat.app.mjs
  • components/browserbase/browserbase.app.mjs
  • components/humanlayer/humanlayer.app.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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/search-crm/search-crm.mjs (2)

207-209: Optimize by reusing the schema from additionalProps.

The schema is already fetched in additionalProps(). Consider storing it in a class property to avoid redundant API calls.

-    const schema = await this.hubspot.getSchema({
-      objectType,
-    });
+    if (!this._schema) {
+      this._schema = await this.hubspot.getSchema({
+        objectType,
+      });
+    }
+    const schema = this._schema;

211-213: Enhance error message with available properties.

Consider including the list of available searchable properties in the error message to help users correct their configuration.

-      throw new ConfigurationError(`\`${searchProperty}\` is not a searchable property of object type \`${objectType}\``);
+      throw new ConfigurationError(
+        `\`${searchProperty}\` is not a searchable property of object type \`${objectType}\`. ` +
+        `Available searchable properties are: ${schema.searchableProperties.join(", ")}`
+      );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c61c62 and daa620b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • components/hubspot/actions/search-crm/search-crm.mjs (2 hunks)
  • components/hubspot/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/hubspot/package.json
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (3)
components/hubspot/actions/search-crm/search-crm.mjs (3)

13-13: LGTM! Good error handling practice.

The addition of ConfigurationError import is appropriate for handling invalid configuration scenarios.


19-19: LGTM! Appropriate version bump.

The version increment from 0.0.11 to 0.0.12 follows semantic versioning and is appropriate for the added validation enhancement.


211-213: LGTM! Good validation practice.

The validation ensures that only searchable properties are used, preventing runtime errors.

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/search-crm/search-crm.mjs (2)

207-216: Add error handling for schema retrieval.

While the validation logic is good, the schema retrieval should include error handling in case the API call fails.

-    const schema = await this.hubspot.getSchema({
-      objectType,
-    });
+    let schema;
+    try {
+      schema = await this.hubspot.getSchema({
+        objectType,
+      });
+    } catch (error) {
+      throw new ConfigurationError(
+        `Failed to retrieve schema for object type \`${objectType}\`: ${error.message}`
+      );
+    }

207-209: Consider caching the schema to avoid duplicate API calls.

The schema is fetched twice - once in additionalProps() and once in run(). Consider storing the schema result from additionalProps() in a class property to avoid the duplicate API call.

 async additionalProps() {
   // ... existing code ...
   try {
     schema = await this.hubspot.getSchema({
       objectType,
     });
+    this._cachedSchema = schema;
     // ... existing code ...
   }
 }

 async run({ $ }) {
   // ... existing code ...
-  const schema = await this.hubspot.getSchema({
-    objectType,
-  });
+  const schema = this._cachedSchema || await this.hubspot.getSchema({
+    objectType,
+  });
   // ... existing code ...
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between daa620b and 6900b8c.

📒 Files selected for processing (1)
  • components/hubspot/actions/search-crm/search-crm.mjs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (2)
components/hubspot/actions/search-crm/search-crm.mjs (2)

13-13: LGTM! Import of ConfigurationError is well-placed.

The addition of ConfigurationError import aligns with the new validation logic and follows Pipedream's best practices.


19-19: LGTM! Version bump is appropriate.

The increment from 0.0.11 to 0.0.12 correctly reflects the addition of new validation functionality without breaking changes.

lcaresia
lcaresia previously approved these changes Jan 27, 2025
@michelle0927
Copy link
Collaborator Author

/approve

lcaresia
lcaresia previously approved these changes Feb 5, 2025
@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit 9ba4464 into master Feb 5, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-15403 branch February 5, 2025 20:13
This was referenced Mar 26, 2025
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 - Search CRM failed with 400 BAD REQUEST error
2 participants