The IF node sends a thread on the False branch even though the condition is met

,

The IF node sends a thread on the False branch even though the condition is met. You can see that the property is present in the incoming json, the checkbox that the condition is met is ticked, but the thread is sent on the False branch.

What can be the problem?

Thanks.

Regards, Alexander.

Information on your n8n setup

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

Hi @asuhan :wave:

To make testing this one easier, could you share some input data in JSON format as well as your workflow? :eyes:

Good afternoon, EmeraldHerald. Thank you for responding.
I have attached the data, but I noticed one thing when I started to prepare the example - if the data is written to the Code node and passed to the IF node, everything works as it should, if the IF node gets directly from the webhook - it goes to the wrong branch.

Maybe it makes sense to put a Set node between WebHook and IF?

Thanks.

Regards, Alexander.

[
  {
    "headers": {
      "host": "n8n.*******.ru",
      "user-agent": "Apache-HttpClient/4.5.13 (Java/17.0.5)",
      "content-length": "630",
      "accept-encoding": "gzip,deflate",
      "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
      "x-forwarded-for": "5.8.30.214",
      "x-forwarded-host": "n8n.********.ru",
      "x-forwarded-port": "443",
      "x-forwarded-proto": "https",
      "x-forwarded-server": "bc3660ec7fb2",
      "x-real-ip": "5.8.30.214"
    },
    "params": {},
    "query": {},
    "body": {
      "cmd": "newMessage",
      "providerId": "webhook*******",
      "token": "keyn8n*********",
      "message": "",
      "messageId": "117904970",
      "userName": "Александр",
      "userLastName": "********",
      "userIco": "https://*****.*******.ru/?action=getuserpic&id=6767112&h=**************d0b27345771690d792a913dd81c",
      "taskEmail": "task+149088@*****************",
      "chatId": "63647073",
      "integration": "chat",
      "attachments[url]": "https://*************/filelink/waning_crescent.png?action=getfile&uniqueid=8736340&auth=********************",
      "attachments[name]": "waning_crescent.png"
    }
  }
]

EmeraldHerald, if you replace {{$json.body.hasOwnProperty("attachments[url]")}} in the condition
{{ !!$json["body"]["attachments[url]" }} then it works as expected. Hope this helps you in finding the reasons.

Thanks.

Regards, Alexander.

2 Likes

Hi @asuhan - so glad that I could help get you on the right track :raised_hands: Thanks so much for posting your solution, too!

Well, I wouldn’t call it a solution, of course… It is not clear why the data from the webhook goes wrong, although the same data in the Code node leads to the correct path.

Regards, Alexander.

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