addon-node-red: Ingress error 502

Problem/Motivation

After recent update (v10.3.4 -> v10.4.0) I experience Ingress error 502. This causes occasional crashes of Dashboard and flow runs.

Expected behavior

No errors, stable behavior

Actual behavior

  • Lost connection to dashboard
  • Missing icons image
  • Addon debug log:
1 Feb 14:27:17 - [info] Stopping flows
1 Feb 14:27:17 - [info] [server:Home Assistant] Closing connection to http://supervisor/core
1 Feb 14:27:17 - [info] Stopped flows
1 Feb 14:27:17 - [info] Starting flows
1 Feb 14:27:17 - [red] Uncaught Exception:
1 Feb 14:27:17 - [error] TypeError: RED.settings.functionGlobalContext.get is not a function
    at map (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:270:51)
    at EventEmitter.runtimeMap (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:593:5)
    at EventEmitter.emit (node:events:390:28)
    at start (/opt/node_modules/@node-red/runtime/lib/flows/index.js:383:12)
[14:27:17] INFO: Starting Node-RED...
2022/02/01 14:27:18 [error] 573#573: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /comms HTTP/1.1", upstream: "http://127.0.0.1:46836/comms", host: "homeassistant.local:8123"
2022/02/01 14:27:19 [error] 573#573: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /icons/node-red-contrib-home-assistant-websocket/ha-wait-until.svg HTTP/1.1", upstream: "http://127.0.0.1:46836/icons/node-red-contrib-home-assistant-websocket/ha-wait-until.svg", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /homeassistant/entities/e5843ff2.b76be HTTP/1.1", upstream: "http://127.0.0.1:46836/homeassistant/entities/e5843ff2.b76be", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /homeassistant/properties/e5843ff2.b76be HTTP/1.1", upstream: "http://127.0.0.1:46836/homeassistant/properties/e5843ff2.b76be", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /red/images/typedInput/az.svg HTTP/1.1", upstream: "http://127.0.0.1:46836/red/images/typedInput/az.svg", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /red/images/typedInput/09.svg HTTP/1.1", upstream: "http://127.0.0.1:46836/red/images/typedInput/09.svg", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /red/images/typedInput/bool.svg HTTP/1.1", upstream: "http://127.0.0.1:46836/red/images/typedInput/bool.svg", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /red/images/typedInput/expr.svg HTTP/1.1", upstream: "http://127.0.0.1:46836/red/images/typedInput/expr.svg", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /red/images/typedInput/re.svg HTTP/1.1", upstream: "http://127.0.0.1:46836/red/images/typedInput/re.svg", host: "homeassistant.local:8123", referrer: "http://homeassistant.local:8123/api/hassio_ingress/<REDACTED>/"
2022/02/01 14:27:19 [error] 573#573: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /comms HTTP/1.1", upstream: "http://127.0.0.1:46836/comms", host: "homeassistant.local:8123"
  • Addon Debug Log (after restart):
1 Feb 14:27:47 - [info] Node-RED version: v2.2.0
1 Feb 14:27:47 - [info] Node.js  version: v16.13.2
1 Feb 14:27:47 - [info] Linux 5.10.91 x64 LE
1 Feb 14:27:50 - [info] Loading palette nodes
1 Feb 14:27:59 - [info] Dashboard version 3.1.5 started at /endpoint/ui
Traceback (most recent call last):
  File "/opt/node_modules/node-red-node-pi-gpio/testgpio.py", line 3, in <module>
    import RPi.GPIO as GPIO
  File "/usr/lib/python3.9/site-packages/RPi/GPIO/__init__.py", line 23, in <module>
    from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
1 Feb 14:28:00 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
1 Feb 14:28:01 - [info] Settings file  : /etc/node-red/config.js
1 Feb 14:28:01 - [info] Context store  : 'default' [module=memory]
1 Feb 14:28:01 - [info] User directory : /config/node-red/
1 Feb 14:28:01 - [warn] Projects disabled : editorTheme.projects.enabled=false
1 Feb 14:28:01 - [info] Flows file     : /config/node-red/flows.json
1 Feb 14:28:01 - [info] Server now running at http://127.0.0.1:46836/
1 Feb 14:28:01 - [info] Starting flows
1 Feb 14:28:02 - [info] [mqtt-broker:Homeassistant MQTT Broker] Connected to broker: http://localhost
1 Feb 14:28:06 - [info] [server:Home Assistant] Connecting to http://supervisor/core
1 Feb 14:28:06 - [info] [server:Home Assistant] Connected to http://supervisor/core
1 Feb 14:28:07 - [red] Uncaught Exception:
1 Feb 14:28:07 - [error] Error: Cannot set headers after they are sent to the client
    at new NodeError (node:internal/errors:371:5)
    at ServerResponse.setHeader (node:_http_outgoing:576:11)
    at ServerResponse.header (/opt/node_modules/express/lib/response.js:776:10)
    at ServerResponse.contentType (/opt/node_modules/express/lib/response.js:604:15)
    at ServerResponse.sendStatus (/opt/node_modules/express/lib/response.js:362:8)
    at /opt/node_modules/node-red-dashboard/nodes/ui_base.js:109:21
    at /opt/node_modules/express/lib/response.js:439:22
    at onaborted (/opt/node_modules/express/lib/response.js:1032:5)
    at Immediate.<anonymous> (/opt/node_modules/express/lib/response.js:1072:9)
    at processImmediate (node:internal/timers:464:21)

Steps to reproduce

  • System: Home Assistant OS 7.2 (amd64 / qemux86-64)

  • Home Assistant Core: 2021.12.10

  • Home Assistant Supervisor: 2022.01.1

  • Addon configuration

certfile: fullchain.pem
credential_secret: <REDACTED>
http_node:
  password: ''
  username: ''
http_static:
  password: ''
  username: ''
init_commands: []
keyfile: privkey.pem
npm_packages: []
ssl: false
system_packages: []
theme: dark
  • Have at least one flow with functional Home Assistant configuration node
    {
        "id": "e5843ff2.b76be",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "credentials": {}
    }
  • Update from v10.3.4 -> v10.4.0.
  • Supervisor log:
22-02-01 12:36:34 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
22-02-01 12:36:34 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
22-02-01 12:36:34 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
22-02-01 12:58:59 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.check] Starting system checks with state CoreState.RUNNING
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.TRUST/ContextType.PLUGIN
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.FREE_SPACE/ContextType.SYSTEM
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.SECURITY/ContextType.CORE
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.TRUST/ContextType.SUPERVISOR
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.PWNED/ContextType.ADDON
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.TRUST/ContextType.CORE
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.check] System checks complete
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state CoreState.RUNNING
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.fixup] Starting system autofix at state CoreState.RUNNING
22-02-01 13:28:58 INFO (MainThread) [supervisor.resolution.fixup] System autofix complete
22-02-01 13:28:59 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
22-02-01 13:44:02 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API error: Received message 8:0 is not WSMsgType.TEXT
22-02-01 13:44:02 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed
22-02-01 13:44:04 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:05 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:06 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:08 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:10 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:12 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:14 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:16 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:18 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
22-02-01 13:44:20 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:63365/comms')
  • Core log:
2022-02-01 12:06:54 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/hassio/__init__.py", line 557, in update_info_data
    await hass.data[ADDONS_COORDINATOR].async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 165, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 509, in _stringify_state
    if not self.available:
  File "/usr/src/homeassistant/homeassistant/components/hassio/entity.py", line 37, in available
    in self.coordinator.data[DATA_KEY_ADDONS][self._addon_slug]
KeyError: 'addons' 

Proposed Changes

Temporary fix rollback to 10.3.4

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 18

Most upvoted comments

@Steveorevo has now published a fix for node-red-contrib-actionflows V2.1.2 is now available in the flows library 👍