Hello everyone,
I was talking with a friend about how we can improve the debugging process of developing a Flow using Node-RED and he came with the idea of having breakpoints like the ones we have in the most famous IDEs.
Wouldn't be nice to have such a thing? Specially if we could manipulate the msg during a break event.
Hi Tiago,
I think this is already on the long-term planning. See this Trello item.
Kind regards,
Bart Butenaers
Hi,
although not exactly what you want, this may help you until the mentioned Trello item is implemented:
At our company when developing new nodes or extending existing nodes we debug somehow like this:
-
https://github.com/Microsoft/vscode-recipes/tree/master/nodemon
-
Instead of "attach" I use the following launch.json:
"version": "0.2.0", "configurations": [ { "name": "Launch node-red via nodemon", "type": "node", "request": "launch", "runtimeExecutable": "nodemon", "program": "/usr/lib/node_modules/node-red/red.js", "restart": true, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } ]
-
find the files of the nodes you are using, open them (or the folder) in vscode.
-
add Breakpoints
-
now when pressing the green arrow for debugging node-red will start via nodemon
-
happy debugging
Best regards
Lars
I wonder if this flow debugger made into the next release.
Hi @fangzhu,
As you can see here the Pluggable Message Routing is still on the roadmap, but not in the 1.0 release. Moreover when that feature ever becomes available, I assume somebody still has to develop some kind of Node-RED debugger on (using the pluggable message routing)?
Bart
Thanks for quick response.
What I wanted is more like a break point that can temporary stop the flow process at some node so that developer can confirm the intermediate result, such as context data, database data at that point etc.
I am looking forward to this wonderful feature in the future.
@fangzhu
A little something I've made to simulate breakpoints on Node-RED nodes.
Very alpha stage, but works for my needs.
node-red-contrib-msg-tracer
Hi Alon (@AlonAmiraabluedragon),
Welcome to the forum!
I had already made some advertisement for your node some time ago:
I'm very impressed by your work!!!
Thanks, I hope you find it useful!
Though I have to admit @knolleary was right in his comment, I did end up using private APIs and "dirty" tricks as mentioned, I verified compatibility with Node-RED 0.20 -> 1.0
but the ability to debug, having "breakpoints", step-by-step, was something I missed greatly while having to maintain complex flows, so for me it's still better than nothing.
Hi @AlonAmiraabluedragon perhaps if you are still interested, you could discuss with Nick & Dave & come to an agreement on implementation then you could contribute to core?
It would take a load off these 2 guys (who I can only imagine are overloaded with the breakneck pace of development) - then everyone would benefit from your contribution by it being built in to core.
Would be good to see such a prominent feature take shape.
A flow debugger is on the roadmap.
It is top of the list once we get the pluggable message router feature in. Doing anything before that would be premature.
Absolutely Nick however I don't think I was clear & you might not have caught my inference. I was inferring the op could assist in the overall solution (including the message routing). As you said in the other thread, a missed opportunity that could bring effort directed at helping deliver the backlog.
Just trying to help & not meaning to step on any toes.