Skip to content

Apollo search contacts bug fix #16443

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

SokolovskyiK
Copy link
Contributor

@SokolovskyiK SokolovskyiK commented Apr 24, 2025

Fixes #16421

While testing the Apollo integration, I noticed a few things that needed fixing:

getResourcesStream wasn’t defined, but elsewhere in the code getIterations was being used
for the same purpose — so I switched to that

There was a small mismatch — utils.streamIterator didn’t exist, but utils.iterate does, so I fixed that

Apollo’s API expected the key in the X-Api-Key header instead of the query params, so I updated the headers accordingly.
Should be fine — but just in case something explodes, you’ve been gently warned 😅

Tested everything using a free Apollo.io account. Auth works, pagination works, and the action runs successfully (even if it returns 0 contacts for now).
Forgive me in advance if I missed something — happy to adjust anything if needed! 🙂

Summary by CodeRabbit

  • New Features

    • The method for sending API keys has been updated to use a secure HTTP header instead of a query parameter.
  • Bug Fixes

    • Improved reliability and consistency when retrieving paginated contact and sequence data.
  • Chores

    • Updated version numbers for multiple actions and sources to reflect recent changes and improvements.

Copy link

vercel bot commented Apr 24, 2025

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Apr 24, 2025 9:23pm

Copy link

vercel bot commented Apr 24, 2025

@SokolovskyiK is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Apr 24, 2025

Warning

Rate limit exceeded

@SokolovskyiK has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c1f4879 and f8a0de5.

📒 Files selected for processing (1)
  • components/apollo_io/actions/search-sequences/search-sequences.mjs (3 hunks)

Walkthrough

The changes update several Apollo IO integration components. The API key is now sent via the "X-Api-Key" HTTP header instead of as a query parameter. In the contact and sequence search actions, the method for fetching paginated data is updated from getResourcesStream with streamIterator to getIterations with iterate, while maintaining the same input and output structures. Additionally, version numbers are incremented for the affected actions and sources to reflect these updates. No changes are made to the overall logic or exported function signatures.

Changes

File(s) Change Summary
components/apollo_io/actions/search-contacts/search-contacts.mjs Updated action version to "0.0.6". Switched data fetching from getResourcesStream/streamIterator to getIterations/iterate.
components/apollo_io/actions/search-sequences/search-sequences.mjs Switched data fetching from getResourcesStream/streamIterator to getIterations/iterate.
components/apollo_io/apollo_io.app.mjs Changed API key transmission from query parameter to "X-Api-Key" HTTP header; updated getHeaders and getParams implementations.
components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs Incremented action version from "0.0.5" to "0.0.6".
components/apollo_io/actions/create-account/create-account.mjs Incremented action version from "0.0.5" to "0.0.6".
components/apollo_io/actions/create-contact/create-contact.mjs Incremented action version from "0.0.6" to "0.0.7".
components/apollo_io/actions/create-opportunity/create-opportunity.mjs Incremented action version from "0.0.4" to "0.0.5".
components/apollo_io/actions/create-update-contact/create-update-contact.mjs Incremented action version from "0.0.3" to "0.0.4".
components/apollo_io/actions/get-opportunity/get-opportunity.mjs Incremented action version from "0.0.4" to "0.0.5".
components/apollo_io/actions/people-enrichment/people-enrichment.mjs Incremented action version from "0.0.7" to "0.0.8".
components/apollo_io/actions/search-accounts/search-accounts.mjs Incremented action version from "0.0.4" to "0.0.5".
components/apollo_io/actions/update-account-stage/update-account-stage.mjs Incremented action version from "0.0.5" to "0.0.6".
components/apollo_io/actions/update-account/update-account.mjs Incremented action version from "0.0.5" to "0.0.6".
components/apollo_io/actions/update-contact/update-contact.mjs Incremented action version from "0.0.6" to "0.0.7".
components/apollo_io/actions/update-opportunity/update-opportunity.mjs Incremented action version from "0.0.4" to "0.0.5".
components/apollo_io/sources/account-created/account-created.mjs Incremented source version from "0.0.5" to "0.0.6".
components/apollo_io/sources/account-updated/account-updated.mjs Incremented source version from "0.0.5" to "0.0.6".
components/apollo_io/sources/contact-created/contact-created.mjs Incremented source version from "0.0.7" to "0.0.8".
components/apollo_io/sources/contact-updated/contact-updated.mjs Incremented source version from "0.0.7" to "0.0.8".
components/apollo_io/package.json Incremented package version from "0.5.1" to "0.5.2".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action (search-contacts/search-sequences)
    participant ApolloIOApp

    User->>Action: Invoke search action
    Action->>ApolloIOApp: getIterations(params)
    ApolloIOApp-->>Action: Iterable results
    Action->>Action: utils.iterate(iterable)
    Action-->>User: Return aggregated results
Loading
sequenceDiagram
    participant Action
    participant ApolloIOApp
    participant Apollo API

    Action->>ApolloIOApp: getHeaders()
    ApolloIOApp->>Apollo API: Send request with X-Api-Key header
    Apollo API-->>ApolloIOApp: Response
    ApolloIOApp-->>Action: Return data
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix the error where this.app.getResourcesStream is not a function in Apollo.io actions (#16421) The code replaces getResourcesStream with getIterations, resolving the missing method.

Suggested labels

ai-assisted

Poem

A rabbit hops through fields of code,
With headers changed, the secrets flowed.
No more keys upon the URL,
Now safely tucked where headers dwell.
Iterations leap, streams replaced—
Version numbers, neatly traced.
🐇✨ Another hop, another fix—
Apollo IO’s bag of tricks!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Apr 24, 2025
@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

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 (1)
components/apollo_io/actions/search-sequences/search-sequences.mjs (1)

9-9: Consider updating the version number.

The version should be incremented to "0.0.5" or "0.0.6" to maintain consistency with other Apollo IO components that were updated in this PR.

-  version: "0.0.4",
+  version: "0.0.6",
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 37e4be7 and 49e2a7e.

📒 Files selected for processing (4)
  • components/apollo_io/actions/search-contacts/search-contacts.mjs (3 hunks)
  • components/apollo_io/actions/search-sequences/search-sequences.mjs (2 hunks)
  • components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs (1 hunks)
  • components/apollo_io/apollo_io.app.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (5)
components/apollo_io/apollo_io.app.mjs (1)

219-219: Authentication method improvement.

The change correctly implements Apollo API's updated authentication requirements by moving the API key from query parameters to the "X-Api-Key" header. This is a more secure practice for API key authentication and aligns with modern API standards.

components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs (1)

8-8: Version increment is appropriate.

The version bump from "0.0.5" to "0.0.6" properly reflects the changes in the underlying API authentication method, maintaining consistency with other updated Apollo IO components.

components/apollo_io/actions/search-sequences/search-sequences.mjs (1)

19-19: Fixed function references for proper data retrieval.

The changes correctly replace:

  1. getResourcesStream with the properly defined getIterations method
  2. utils.streamIterator with the existing utils.iterate function

These replacements fix the undefined function issues while maintaining the same pagination and data retrieval functionality.

Also applies to: 29-29

components/apollo_io/actions/search-contacts/search-contacts.mjs (2)

9-9: Version increment is appropriate.

The version bump from "0.0.4" to "0.0.6" properly reflects the changes in the authentication method and function references.


46-46: Fixed function references for proper data retrieval.

The changes correctly replace:

  1. getResourcesStream with the properly defined getIterations method
  2. utils.streamIterator with the existing utils.iterate function

These replacements fix the undefined function issues while maintaining the same pagination and data retrieval functionality.

Also applies to: 59-59

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

🧹 Nitpick comments (1)
components/apollo_io/actions/search-contacts/search-contacts.mjs (1)

4-66: Consider adding type annotation for better documentation.

For better code documentation and developer experience, consider adding JSDoc comments to describe the expected input and output types of the function. This was mentioned in the component guidelines checklist shared by the Pipedream team.

 export default {
   key: "apollo_io-search-contacts",
   name: "Search For Contacts",
   description: "Search for contacts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)",
   type: "action",
   version: "0.0.6",
+  /**
+   * @param {Object} $ - The event object
+   * @returns {Array<Object>} An array of contacts matching the search criteria
+   */
   props: {
🧰 Tools
🪛 GitHub Check: Lint Code Base

[failure] 9-9:
Trailing spaces not allowed

🪛 GitHub Actions: Pull Request Checks

[error] 9-9: ESLint: Trailing spaces not allowed (no-trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49e2a7e and 965cfc8.

📒 Files selected for processing (18)
  • components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs (1 hunks)
  • components/apollo_io/actions/create-account/create-account.mjs (1 hunks)
  • components/apollo_io/actions/create-contact/create-contact.mjs (1 hunks)
  • components/apollo_io/actions/create-opportunity/create-opportunity.mjs (1 hunks)
  • components/apollo_io/actions/create-update-contact/create-update-contact.mjs (1 hunks)
  • components/apollo_io/actions/get-opportunity/get-opportunity.mjs (1 hunks)
  • components/apollo_io/actions/people-enrichment/people-enrichment.mjs (1 hunks)
  • components/apollo_io/actions/search-accounts/search-accounts.mjs (1 hunks)
  • components/apollo_io/actions/search-contacts/search-contacts.mjs (3 hunks)
  • components/apollo_io/actions/update-account-stage/update-account-stage.mjs (1 hunks)
  • components/apollo_io/actions/update-account/update-account.mjs (1 hunks)
  • components/apollo_io/actions/update-contact/update-contact.mjs (1 hunks)
  • components/apollo_io/actions/update-opportunity/update-opportunity.mjs (1 hunks)
  • components/apollo_io/package.json (1 hunks)
  • components/apollo_io/sources/account-created/account-created.mjs (1 hunks)
  • components/apollo_io/sources/account-updated/account-updated.mjs (1 hunks)
  • components/apollo_io/sources/contact-created/contact-created.mjs (1 hunks)
  • components/apollo_io/sources/contact-updated/contact-updated.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (17)
  • components/apollo_io/package.json
  • components/apollo_io/actions/create-opportunity/create-opportunity.mjs
  • components/apollo_io/actions/create-update-contact/create-update-contact.mjs
  • components/apollo_io/sources/account-updated/account-updated.mjs
  • components/apollo_io/sources/contact-updated/contact-updated.mjs
  • components/apollo_io/actions/create-contact/create-contact.mjs
  • components/apollo_io/actions/update-contact/update-contact.mjs
  • components/apollo_io/actions/update-account-stage/update-account-stage.mjs
  • components/apollo_io/actions/update-account/update-account.mjs
  • components/apollo_io/actions/update-opportunity/update-opportunity.mjs
  • components/apollo_io/actions/get-opportunity/get-opportunity.mjs
  • components/apollo_io/actions/people-enrichment/people-enrichment.mjs
  • components/apollo_io/sources/account-created/account-created.mjs
  • components/apollo_io/actions/search-accounts/search-accounts.mjs
  • components/apollo_io/sources/contact-created/contact-created.mjs
  • components/apollo_io/actions/create-account/create-account.mjs
  • components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/apollo_io/actions/search-contacts/search-contacts.mjs

[failure] 9-9:
Trailing spaces not allowed

🪛 GitHub Actions: Pull Request Checks
components/apollo_io/actions/search-contacts/search-contacts.mjs

[error] 9-9: ESLint: Trailing spaces not allowed (no-trailing-spaces)

⏰ 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/apollo_io/actions/search-contacts/search-contacts.mjs (2)

46-47: Method change looks good.

The change from getResourcesStream to getIterations appropriately addresses the bug mentioned in the PR description. This ensures the code is using a defined function that exists elsewhere in the codebase for similar purposes.


59-59: Function change looks good.

Replacing utils.streamIterator with utils.iterate is appropriate and matches the PR description. This ensures the code is using a function that actually exists in the utility module.

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

LGTM! Ready for QA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Apollo.io actions might not work?
4 participants