How to fix broken Node-RED flows?
Node-RED is a popular open-source flow-based programming tool that allows users to create and deploy applications. However, if your Node-RED flows are stuck in an endless loop of crashing, it can be frustrating to troubleshoot. In this guide, we will explain how to recover your Node-RED flows by booting Node-RED in safe mode.
Problem
There could be several reasons why the Node-RED flow is going into a loop, such as a misconfigured node, especially azure-iot-hub and python3-function
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
- Using UMHLens, connect to the cluster and select the namespace where Node-RED is located.
- Go to Apps > Releases and select your releases.
- Search for
NODE_RED_ENABLE_SAFE_MODE
and change the value fromfalse
totrue
. - Save the changes.
If you receive an error message saying RELEASE not found
in UMHLens / OpenLens while saving, follow this guide to fix it.
Before 0.6.1
- Using UMHLens, connect to the cluster and select the namespace where Node-RED is located.
- Select the StatefulSet Node-RED. A popup should appear on the right side.
- Press the edit button / pen symbol on top right of the screen.
- Find the line env: and add the following underneath it:
- name: NODE_RED_ENABLE_SAFE_MODE
value: "true"
-
Press save.
-
If necessary, terminate the pod manually (or if you are impatient).
-
Node-RED should now start in safe mode, which means it will boot but not execute any flows.
-
Make your changes and fix the nodes.
-
Repeat steps 1-5, but this time set
NODE_RED_ENABLE_SAFE_MODE
tofalse
.