Set + HTTP Request loop

Hi all,

I cannot figure out this one, looking for some help.
I define n8n.endpoint in a Set, and try to use it in an HTTP Request loop later on. However, the correct value is used in the first iteration, but it’s lost in the upcoming iterations.
This is my simplified workflow:

If I hardcode the URL on the HTTP Request node, it works just fine.

Information on your n8n setup

  • n8n version: 0.183.0
  • Database you’re using (default: SQLite): Postgres
  • Running n8n with the execution process [own(default), main]: main
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @fcecagno,

Give the workflow below a bash, There was a change to the way you can get items from a node so you can use the old $items(“node name”) option or the experimental pairedItem option which is not yet available for all nodes.

For fun I have also used the new public API as that is less likely to change in the future.

1 Like

Nice, thanks @Jon.

Your suggestion worked. In short, on the HTTP Request loop I changed:

{{$node["Globals"].json["n8n"]["endpoint"]}}

to

{{$("Globals").pairedItem().json.n8n.endpoint}}

I was not familiar with this syntax, but it worked.
If it isn’t ask too much, @Jon, can you elaborate why the original option didn’t work in this case?

Hey @fcecagno,

I think we made a change in 183 to how it works when calling previous node data but I would need to double check.

Hi all, i have a similary problem…i have a webhook, more components and an HTTP Request loop. The url of the http request takes a value of the webhook (https://mysite/objects/{{$node[“Webhook”].json[“headers”][“application-id”]}})

However, the correct value is used in the first iteration, but it’s lost in the upcoming iterations. If I hardcode the URL on the HTTP Request node, it works just fine.

Thanks a lot in advanced.

Hi @pscrigna, welcome to the community :tada:

Sounds like you might have run into the problem described over here, so you might need to add .first() into the mix here.

If you run into any trouble with this it’d be great if you could post a simplified example workflow using which your problem can be reproduced in a new thread.

Hi JAM.

I resolved it adding item(0). in the expression ({$item(0).$node[“Webhook”].json[“headers”][“application-id”]}})

Thanks for your response.

Regards
pablo

1 Like

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