Code versus Function Node(s)

Hi there,

Having been away from n8n for half a year, I decided to go through the Documentation again … just to make sure that I did not miss any of the new functions. When I tried out the code from this example …

items[0].json.variable1 = $evaluateExpression('{{1+2}}');

return items;

… in the Code node, I got the following error:

ERROR: `items` is not defined. Did you mean `$input.all()`? [line 1]

But when I copied the same code into an old (/converted?) Function node, the same code works as expected …

What did I miss, or am I doing wrong and/or should I be doing differently?

Hi @dickhoning

Yes this is very annoying sometimes. You cannot use items and item anymore.
easiest way is to set this in the top of the code node:
let items = $input.all();


Hi @BramKn thanks for the tip!

And to whom it may concern; you may want to add this to the documentation!


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