How to use callback functions in expression block

Hey! I am trying to calculate upsert query for postgres node, but struggle to mention all the fields.

This thing works fine:

{{Object.keys($json).sort().join(',')}}

But when I go to values it shows error (same code works in browser console):

{{ Object.keys($json).sort().map((x) => { $json[x] })  }}
[invalid (Expression is not valid: Invalid destructuring assignment target)]

Any ideas how to fix this annoying?

Welcome to the community @arrowcircle !

That is sadly not possible because of a bug in the underlying library that n8n uses. You can find the GitHub ticket here:

Right now the only way is to use a Function-Node.

1 Like