N8N loosing set-variables in url-field expression upon start of request

I created a Set with configuration data, such as API URL, Project Name etc.
I’m accessing it in a httpRequestNode in the URL Field multiple times.

The full expression looks something like this

{{$node["Configuration"].json["noco"]["url"]["api"]}}
/db/data/{{$node["Configuration"].json["noco"]["organization"]["name"]}}
/{{$node["Configuration"].json["noco"]["project"]["name"]}}
/{{$node["Configuration"].json["noco"]["table"]["prefix"]}}Projects

The request is executed on a dataset with at the time of test 5 entries.

But when executing the workflow, only 1 of 5 requests - apparently the first, requested the full substituted URL.

The others try to request /db/data///Projects which basically means that the set was undefined for the remaining 4 iterations.

Information on your n8n setup

  • n8n version: 0.194.0
  • Running n8n via Docker

Just managed to solve it by using $item(0).$node
Doesn’t seem so straightforward if a loop is implicit

1 Like

Hey @rweber,

Welcome to the community :cake:

I suspect the issue here will be down to how we handle loops internally. When you first call it we will use the item at index 0 and if you have multiple inputs we try to be clever and increment the index. In some cases this doesn’t work and you would have to use the $item(0) option as you have found to specify the index to use.

We have been working on making this process easier to use and a future release this should be a lot better and less confusing.

1 Like

Thanks for the reassurance :smiley:
Looking forward to future releases!

1 Like