I have a WF with 2 triggers. Depending on which is fired, I follow a different path.
This decision is made a Switch.
In this switch, the switch tests which objects exists.
Unfortunately I get an erro and the situation is not consistent:
Cf. screenshot: @left side you can see the ClickTrigger exists but is empty. That is literally what n8n states. @right side, n8n states it threw an error as the … same object does not exist.
(?!)
You can see the “1 item” along the green line there.
So the Object DOES exist.
There is more weirdness going on: (2 separate errors?)
When I test-run the “Switch” step, instead of assessing the Click-flow exists and (thus) proceed with that Route, it invariably
does not proceed with that Route, even if the object exists, and
which uncalled for: it triggers the Chat node
Also, it should not complain about a Node not existing as that is exactly what I am testing for:
Your switch has two evaluations, which impossible to evaluate, as both triggers will never be executed. The correct way I’ve provided earlier in the workflow
This will work yet… I am still left somewhat on my “logic” hunger; I find it strange you can’t test if a node exists or not.
If it did not run (which is OK) and therefore does not exist (also very OK & fair), why… is it impossible to indeed confirm that a non-existent node does indeed not exist?
?
I tried your suggestion. It does not work either; whenever I enter the Switch and test this step, it (uncalled) fires the ChatTrigger by itself, which sets the Trigger Type to ChatTrigger.
→ The “gotoTelegram” route is never reached.
I think it’s because ‘exists’ checks if the variable exists or null / undefined. But when you are trying to access the non-existed node you will get an error, which should be processed via try/catch block.
I am testing it with the “play” button on top of the “Click” trigger (to avoid also triggering the chat trigger).
Then I click “Play” on the Set Field Node connected just to that Trigger. Then on the “Play” of the “Switch”. All goes fine (and I can follow this with the green lines) till I reach the Switch Node.
→ Is this the wrong way?
On yr reply to test non-existent Nodes for non-existence: weird no?
That should just work.
Yes, when you click the play button on the switch node (and any after it) the WF will wait for the message from the chat trigger, because that trigger has a precedence over the manual trigger
Interesting… one learns something new every day!
And about that day: you made my day - by clicking the fat red button next to the Click Trigger, it worked as expected.
So I guess your assumption about the priority is correct.
I love n8n , even if there’s still some fine-print edges I need to get familiar with (like the non-existent nodes and the “right” way to trigger, as you see)
Thanks again Barn!