Issue while fetching and assigning values to my code node

Describe the problem/error/question

Hi Team,

I’ve encountered two issues:

  1. The HTTP node is not working as expected. When we fetch HubSpot users via Postman, we get 4 users. However, when we fetch companies using the HTTP node, we receive 16 users (the 4 users repeated). Why is this happening?
  2. On different nodes, I receive different email data. However, when I retrieve this email data in the code node, the data is repeated. Specifically, I’m fetching emails from both HubSpot and Brevo, but in the code node, Brevo emails are duplicated, whereas HubSpot emails are correct.

Could you please help with these issues?

Note: We are aware that our system is running on an older version, but these are basic nodes that should work without requiring a version update, in my opinion.

What is the error message (if any)?

NA

Please share your workflow

Share the output returned by the last node

brevoAccountEmail hubSpotAccountEmail
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]

Information on your n8n setup

  • n8n version: 0.234.1
  • **Database (default: SQLite):**postgresql
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):**Default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):**Docker
  • Operating system: MAC

@Gouravdev , you call the very same HubSpot API endpoint as many times as you get Brevo users. You need to configure HTTP Request node for HubSpot API to execute only once after all you are trying to get all the owners, not something specific to each Brevo user.

Alternatively, you could separate the retrieval of the contacts from both systems and join them with merge prior to further processing. Something like this.

Hi @ihortom
Thanks for answering.
1 issue is being fixed by your answer.

For 2, I need more help.

My use case is as follows: I need to fetch the email IDs from both brevoUser1 and HubSpotUser1. After that, I need to check if the email IDs of HubSpotUser1 are present in brevoUser1. If they are present, I will allow it to pass further; if not, I will assign the email ID whose ownership is true.

I have tried different methods, but currently, all I need are the email IDs of both brevoUser1 and HubSpotUser1 at the OwnerDetail1 code node so that I can write the logic. However, I am facing an issue where I am getting the same email IDs for brevoUser1, like this:

I have tried this way too but getting error

my expected output will be like

brevoAccountEmail hubSpotAccountEmail
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]

@Gouravdev , you can use Merge node for that (you shouldn’t be connecting two branches to the Code node the way you did in the last workflow).

I will simplify this for a quick demo using some dummy data.

After Merge node you can use IF node to apply further logic you described for item 2.

1 Like

Thanks @ihortom for the quick response, I will check and update. :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.