Get 502 Bad Gateway from HA while selecting Node-RED

I have been using Node-RED for a couple of months and love it. Unfortunately, I can no longer access it; I get 502 Bad Gateway nginx. The two newest changes I made were upgrading to the latest release of Node-RED and creating a new flow. I don't know why either of these things would cause this problem. It seems as though Node-RED keeps restarting because of a poll-state.status.error (listed below).`
I am totally lost so any help would be greatly appreciated.``

Errors in my log include:
[error] [poll-state:North Stairs Sprinker System] poll-state.errors.offset_nan
[error] Error: poll-state.status.error at PollState.getInterval (/opt/node_modules/node-red-contrib-home-assistant-websocket/dist/nodes/poll-state/controller.js:127:19)
[info] [server:Home Assistant] Connecting to http://supervisor/core
TCP 192.168.1.136:9999 Error: connect ECONNREFUSED 192.168.1.136:9999
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '192.168.1.136',
port: 9999
`
[error] Error: poll-state.status.error
at PollState.getInterval (/opt/node_modules/node-red-contrib-home-assistant-websocket/dist/nodes/poll-state/controller.js:127:19)
at PollState.onIntervalUpdate (/opt/node_modules/node-red-contrib-home-assistant-websocket/dist/nodes/poll-state/controller.js:132:31)
at EventEmitter.emit (node:events:532:35)
at /opt/node_modules/node-red-contrib-home-assistant-websocket/dist/homeAssistant/Websocket.js:223:27
[09:44:22] INFO: Starting Node-RED...

start
node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
22 Feb 09:44:26 - [info]
Welcome to Node-RED
===================
22 Feb 09:44:26 - [info] Node-RED version: v2.2.1
22 Feb 09:44:26 - [info] Node.js version: v16.14.0
22 Feb 09:44:26 - [info] Linux 5.10.92-v8 arm64 LE
22 Feb 09:44:28 - [info] Loading palette nodes
22 Feb 09:44:36 - [info] Dashboard version 3.1.5 started at /endpoint/ui
22 Feb 09:44:37 - [info] Settings file : /etc/node-red/config.js
22 Feb 09:44:37 - [info] Context store : 'default' [module=memory]
22 Feb 09:44:37 - [info] User directory : /config/node-red/
22 Feb 09:44:37 - [warn] Projects disabled : editorTheme.projects.enabled=false
22 Feb 09:44:37 - [info] Flows file : /config/node-red/flows.json
22 Feb 09:44:38 - [info] Server now running at http://127.0.0.1:46836/
22 Feb 09:44:38 - [info] Starting flows
22 Feb 09:44:39 - [info] Started flows
22 Feb 09:44:39 - [info] [server:Home Assistant] Connecting to http://supervisor/core
22 Feb 09:44:39 - [info] [server:Home Assistant] Connected to http://supervisor/core
22 Feb 09:44:40 - [error] [poll-state:North Stairs Sprinker System] poll-state.errors.offset_nan
22 Feb 09:44:40 - [red] Uncaught Exception:
22 Feb 09:44:40 - [error] Error: poll-state.status.error
at PollState.getInterval (/opt/node_modules/node-red-contrib-home-assistant-websocket/dist/nodes/poll-state/controller.js:127:19)
at PollState.onIntervalUpdate (/opt/node_modules/node-red-contrib-home-assistant-websocket/dist/nodes/poll-state/controller.js:132:31)
at EventEmitter.emit (node:events:532:35)
at /opt/node_modules/node-red-contrib-home-assistant-websocket/dist/homeAssistant/Websocket.js:223:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
[09:44:40] INFO: Starting Node-RED...

Welcome to the forum @SWAXXIII

Home Assistant is little used by those here, and that appears to an HA problem rather than node-red, so you might be better off asking in a Home Assistant forum. There appears to be a bug in Poll State node (whatever that is), since no user error with a node should cause it to crash node-red.

Isn't the [red] uncaughtException error a node red error or bug?

@SWAXXIII no. It is a bug with the HA websocket node not handling it's errors properly.

Node-RED cannot swallow async errors as if they didn't happen. Nodes need to handle them otherwise they leave the system in an unknown state and the only safe option is to restart.

Okay, thanks! I will try to get some help on the HA side.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.