In a webhook, I’m having difficulties getting right the response mode of Last Node with the First entry JSON.
This webhook workflow that is a bit complex. It has around 60 nodes by now, and many of these are nodes that execute other workflows that I’m not counting.
My difficulty, and source of many bugs, is predicting that the last node to be executed correctly is the one I suppose.
For example, in the flow of the nodes, many times I have a Set node to build the json response. But it may have a parallel flux that sends a message but it doesn’t have to wait to finish to return. The problem is that sometimes it takes the output from this message sending node instead of the one I set up to return. I’m fixing using a merge node with a pass-through, that will wait for the output of the message sending node and the main flow to send just the main flow forward.
I tried to use things like No-Op nodes and others to kill the output chain, so the branch is executed but in the end they don’t set any output, but I got no luck.
In this minimal workflow, I have to nodes to set the response, one returning a
and the other returning b
. The webhook always returns the b
, no matter what I do, I cannot change who is chosen by the webhook.
I tried to read and debug the code that decides this but I didn’t get much farther.
Is there any way to control this in a scalable way? Today’s ways add a lot of complexity.
Proposal
I also was thinking about creating a flag for the nodes, like the one in the settings of a node (eg: Always Output Data), that would help to control who may or may not be used in the webhook return.
It’s a simple addition that could help a lot to reduce the risks of workflow bugs, complexity, and scalability for big webhook workflows.
I think something like a boolean Webhook response, and that if there is any node with this flag on, it will filter the results to include only the nodes with that flag. Otherwise, if none of the nodes has it on, then it works just like it does now. This way helps reducing changes of bugs caused by a node that you created and create an output, but you forgot to filter out.
I willing to implement this myself, so, how does this idea sound?