JS Syntax Help

{{$node[“aggregateCoachRows”].json[“id”].some(id=> id === $node[“iterateTrainers”].json[“id”])}}

Why would this give me this error: [invalid (Expression is not valid: Malformed arrow function parameter list)] (edited)

This is an array: $node[“aggregateCoachRows”].json[“id”].

This is an INT $node[“iterateTrainers”].json[“id”]

What is the error message (if any)?

{
“nodes”: [
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “c8b8aaac-0025-4cd2-b779-470a7eb16e6e”,
“options”: {}
},
“name”: “Webhook”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 1,
“position”: [
-380,
340
],
“webhookId”: “c8b8aaac-0025-4cd2-b779-470a7eb16e6e”
},
{
“parameters”: {
“authentication”: “genericCredentialType”,
“genericAuthType”: “httpBasicAuth”,
“requestMethod”: “POST”,
“url”: “https://api.trainerize.com/v03/user/getTrainerList”,
“jsonParameters”: true,
“options”: {},
“bodyParametersJson”: “={\n “sort”: “name”,\n “start”: 0,\n “count”: 100\n}”
},
“name”: “getTrainerList”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 2,
“position”: [
80,
340
],
“credentials”: {
“httpBasicAuth”: {
“id”: “22”,
“name”: “54D Trainerize Connection”
}
}
},
{
“parameters”: {
“fieldToSplitOut”: “users”,
“options”: {}
},
“name”: “iterateTrainers”,
“type”: “n8n-nodes-base.itemLists”,
“typeVersion”: 1,
“position”: [
240,
340
]
},
{
“parameters”: {
“conditions”: {
“boolean”: [
{
“value1”: “={{$node[“aggregateCoachRows”].json[“id”].some(id=> id === $node[“iterateTrainers”].json[“id”])}}”
}
]
}
},
“name”: “IF”,
“type”: “n8n-nodes-base.if”,
“typeVersion”: 1,
“position”: [
400,
340
]
},
{
“parameters”: {
“operation”: “executeQuery”,
“query”: “SELECT * FROM coaches;”
},
“name”: “queryCoachTable”,
“type”: “n8n-nodes-base.mySql”,
“typeVersion”: 1,
“position”: [
-220,
340
],
“credentials”: {
“mySql”: {
“id”: “25”,
“name”: “apps.fitnessmarketingmachine.net
}
}
},
{
“parameters”: {
“operation”: “aggregateItems”,
“fieldsToAggregate”: {
“fieldToAggregate”: [
{
“fieldToAggregate”: “id”
}
]
},
“options”: {}
},
“name”: “aggregateCoachRows”,
“type”: “n8n-nodes-base.itemLists”,
“typeVersion”: 1,
“position”: [
-80,
340
]
}
],
“connections”: {
“Webhook”: {
“main”: [
[
{
“node”: “queryCoachTable”,
“type”: “main”,
“index”: 0
}
]
]
},
“getTrainerList”: {
“main”: [
[
{
“node”: “iterateTrainers”,
“type”: “main”,
“index”: 0
}
]
]
},
“iterateTrainers”: {
“main”: [
[
{
“node”: “IF”,
“type”: “main”,
“index”: 0
}
]
]
},
“queryCoachTable”: {
“main”: [
[
{
“node”: “aggregateCoachRows”,
“type”: “main”,
“index”: 0
}
]
]
},
“aggregateCoachRows”: {
“main”: [
[
{
“node”: “getTrainerList”,
“type”: “main”,
“index”: 0
}
]
]
}
}
}


## Share the output returned by the last node
<!-- If you need help with transforming the data, please also share the expected output -->

## Information on your n8n setup
- **n8n version:**
- **Database you're using (default: SQLite):**
- **Running n8n with the execution process [own(default), main]:**
- **Running n8n via [Docker, npm, n8n.cloud, desktop app]:**

Hi @coachmikemonte

Welcome to the community!

I cannot copy your workflow into my environment. I guess something got messed up when you posted it.
Could you try inserting it in a preformatted text (the </> option)

Hey @coachmikemonte,

From what I have seen the expressions don’t support arrow functions, For small bits of javascript they are all good but if you wanted something more you would need to use a function node.

1 Like