How to fix broken Node-RED flows?

This troubleshooting guide describes how you can recover Node-RED flows that are stuck in an endless loop of crashing.

If your Node-RED flow is going into a loop, it could be due to a misconfigured node. In any case, you can fix the issue by booting Node-RED in safe mode.

Problem

There could be several reasons why the Node-RED flow is going into a loop:

  • Misconfigured node especially azure-iot-hub and python3-function)
  • Node-RED installed as part of the United Manufacturing Hub (either as factorycube-edge or factorycube-server)

Solution

To boot Node-RED in safe mode, you will need to change the environment variable NODE_RED_ENABLE_SAFE_MODE to true. Follow the instructions below depending on your version of Node-RED:

After 0.6.1

  1. Using UMHLens, connect to the cluster and select the namespace where Node-RED is located (factorycube-edge or factorycube-server).
  2. Go to Apps > Releases and select your releases.
  3. Search for NODE_RED_ENABLE_SAFE_MODE and change the value from false to true.
  4. Save the changes.

If you receive an error message saying RELEASE not found in UMHLens while saving, follow this guide to fix it.

Before 0.6.1

  1. Using UMHLens, connect to the cluster and select the namespace where Node-RED is located (factorycube-edge or factorycube-server).

  2. Select the StatefulSet Node-RED. A popup should appear on the right side.

  3. Press the edit button.

    Press the edit button / pen symbol on top right of the screen

    Press the edit button / pen symbol on top right of the screen

  4. Find the line env: and add the following underneath it:

    - name: NODE_RED_ENABLE_SAFE_MODE
      value: "true"
    
  5. Press save.

  6. If necessary, terminate the pod manually (or if you are impatient).

  7. Node-RED should now start in safe mode, which means it will boot but not execute any flows.

  8. Make your changes and fix the nodes.

  9. Repeat steps 1-5, but this time set NODE_RED_ENABLE_SAFE_MODE to false.

After following these steps, your Node-RED flow should no longer go into a loop

Last modified February 17, 2023: update (#208) (ea731fc)