Retrieving data from another node + retrieving multiple node items don't work anymore after update

Hi !

I’m coming here because i just updated my n8n instance to 0.182.1
And there are 2 changes that impacted my production a lot :


Issue 1

Example

Description

In this case, if i’m sure that the node 2 will execute BEFORE the node Foo, i should be able to retrieve its data in the node Foo with a simple const var2 = $node["2"].json;.

Problem

Before updating, this was totally possible, and worked perfectly.
Now, my Foo node throws the error :
ERROR: The node "Foo" is not connected with node "2" so no data can get returned from it. [Line 2]
I understand this is safer, but as far as i know, it was not written in the update changelogs, and really messes up lots of my workflows.

What i tried

  • Updating to 0.183.0, didn’t solve the issue
  • Linking the previous node to the one i need the items on. This created other issues as the node input is now different.

Question

How can i retrieve another (not linked) node items without linking it ?


Issue 2

Example

Description

I would like to retrieve a previous node items from a Function node, which should be possible with a simple const tmp = $node["TMP"].json;.

Problem

Before updating, this was totally possible, and worked perfectly.
Now, my TMP node only returns the 1st item it finds.

What i tried

  • Updating to 0.183.0, didn’t solve the issue
  • Using const tmp = $items().$node["TMP"].json;, didn’t work

Question

How can i retrieve all items from a previous node, instead of just the 1st one ?

Hi @Gwendal

Welcome to the community.

Issue 1 can be solved with the merge node:
image
Not sure if this applies to al your use cases, but would work in this specific example.

About the actual change, no clue on that.

Issue 2
Never used it like that. Depending on the function, the function Item node can be helpful to use if you just want to do something for each item.

item.key = $node["TMP"].json.key;
return item;

Not sure how to do this for the normal function and a specific node output. I’ve only used function nodes directly with the input sofar.

Hi !

Answer to @BramKnuever

Thanks a lot for your answer !
Problem is i don’t want to merge my 2 nodes outputs, and the Wait option doesn’t return any data.

Solution

Description

replace every $node["2"].json by $items("2")[0].json
This fixed both issues

Examples

Issue 1 fixed

Issue 2 fixed

Thanks

Huge thank to Jon from Discord who gave me this solution !
Thanks a lot to anyone who helped me fix that issue :slight_smile:

2 Likes