Array functions like find and filter considered invalid syntax in expression

Hello,

When using array functions like find or filter, I get an “invalid syntax” message, when I use it in
an expession:

Strangely, I still get the correct output, just the erroneous message.

Kind regards,

Jos

Hi @Jos_van_Uden :wave:

Can you let us know the following to see if we can reproduce this?

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Would you also be able to share a workflow with us that we can reproduce this in that would not require any external credentials? :+1:

Hi @Jos_van_Uden, I am afraid expressions in n8n will use a template engine which doesn’t fully support fat arrow functions. So your best bet would be to use this function in a Code node (and then use a subsequent IF node to filter based on the result produced in the Code node).

There was a discussion around moving to a more capable library at some point, though I am not fully sure what the outcome was and if there are any plans to change this. @ivov, do you know more on this topic?

Work is underway to replace riot-tmpl with a new ES6-compatible lib written by the team.

3 Likes

Hello,

Thanks for the responses. I noticed in the documentation that I can’t use arrow functions (yet).
I guess I could use $jmespath.

Kind regards,

Jos

1 Like

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