Web Request node evaluates variables to null after first run

Describe the issue/error/question

The Web Request node ignores the SET value after 1st execution… Am I missing something very obvious?

I am setting a client name through the initial SET value, which is a placeholder for a future webhook trigger. it will be a single value for the duration of the flow.

at some point I get multiple items in my data, in the final node, web request, I have used the SET node value, but all iterations except first act as if the SET value is null.

What is the error message (if any)?

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

1st execution calls https://webhook.site/0531729b-ad0b-497e-b52b-e22f7ca74557?q=xxx&test=xxx
2nd execution calls https://webhook.site/0531729b-ad0b-497e-b52b-e22f7ca74557?q=
3rd execution calls https://webhook.site/0531729b-ad0b-497e-b52b-e22f7ca74557?q=
and all following executions call the same

Information on your n8n setup

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

In the HTTP node. Change {{$node["Set"].json["clientName"]}} to {{$item(0).$node["Set"].json["clientName"]}}

I understand the workaround, but is this normal behavior?

It’s normal behavior. The HTTP node receives multiple items as input, and in the HTTP node, you are referencing a node that returns one item. n8n executes the node as many times as inputs and uses the input index to resolve the expressions. You get the following:

Iteration Expression Expression resolved
1 $node[“Set”].json[“clientName”] xxx
2 $node[“Set”].json[“clientName”] undefined
3 $node[“Set”].json[“clientName”] undefined
n $node[“Set”].json[“clientName”] undefined

Thanks for the answers; I didn’t come across this situation it seems :slight_smile:

Probably because you had not tried with multiple items, with only one item works fine. Anyways, great that it worked. Let us know if you have further questions.

or I was using SET within SplitInBatches along with the request in which case no problem occurs naturally.