Node-RED Breakpoints

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

2 Likes

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.