Home Assistant Community Add-on: Node-RED

At this moment I don’t have any problems anymore. I’m running on the latest versions of NodeRed (3.0.3) and Hassio 0.92.2.

Because NodeRed has (working) ingress now, I had to remove the NodeRed instance of panel_iframe from the configuration.yaml file.

In the NodeRed addon settings I activated the switch “show in sidebar”. This is my config:

{
  "credential_secret": "secret stuff1",
  "dark_mode": false,
  "http_node": {
"username": "secret stuff2",
"password": "secret stuff1"
  },
  "http_static": {
"username": "secret stuff2",
"password": "secret stuff1"
  },
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": true,
  "system_packages": [],
  "npm_packages": [],
  "init_commands": [],
  "log_level": "info",
  "port": 1880
}

If you’re using Chrome browser, right click within the Hassio interface and click “inspect element”. Under the “Application” tab, delete every local/session storage and the cache. Try also emptying the browser cache etc. Do this of course after updating to the latest versions.

I happen to be also running hassio on a VM, so we might have a similar setup. Tell me if you need more information and I’ll do my best to help you.

1 Like

Yeah all those login problems were sorted out with the 3.0.3 update.

The problem I have/had was I after I migrated from my RPi to VirtualBox VM where I had the cannot read property for all my devices. Like you had on the 17th April and I had on the 24th April

Apr 12:25:21 - [error] [server-state-changed:8b2a5b15.0e3fe8] TypeError: Cannot read property 'addListener' of undefined

The short of it:
You can only use the first password you entered in the “credential_secret” in your node red settings, if changed the password you have to revert back the old one and reboot.

The detailed version

The root cause of the issue lies with the “credential_secret” which once you enter it for the first time save and restart node red it encrypts you workflows with that password and that password alone.

You won’t run into any difficulties until you do something big that causes node red to requery the password found in your credentials file against the encrypted key in config/node-red/flows_cred.json in which case they won’t match and Node-red won’t be able to access your flows to execute them.

What I noticed from my backups is the encryption in the file config/node-red/flows_cred.json changes even though I only changed my password once. I am guessing it could have something to do with when you deploy your flows.

The trick I found was to put my original password I created (thank you lastpass for keeping histories) in the config of the node red addon. I then went into my snapshots and into the config/node-red/flows_cred.json file starting with newest and working backwards until the encryption key I used didn’t produce the errors and this meant I didn’t have to lose anything in home assistant via full restore.

I have seen this type of thing mentioned around by @frenck (an admin) and by the developer on the node red forum although they did not specifically target this issue it was enough to get me on the right track and hopefully anyone else that comes across the same issue (where you changed your credential key not knowing you only get one shot at creating it and comes back to haunt you).

Hello

I also have got the same login loop problem ! :frowning: I have the latest Node Red and Hassio installed. Someone can give me some step-by-step instructions to get the dashboard back, please ?! I will loose all of my hair very soon ! :slight_smile:
Thanks a lot in advance

If you could provide node red log (at the bottom of the node red addon) and maybe HA log (last icon on the right under developer tools) the problem is probably logged in either one of these if you post here one of us might be able to pick out what the error is and point you in the right direction.

ps remember to use 3 of these ``` badboys above and below your each log/code paste which puts keeps it in code format.

Hello

Here it is the the node red log "
[16/May/2019:11:31:17 +0200] 401 -(192.168.130.58) GET /ui HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)
[16/May/2019:11:31:40 +0200] 401 -(192.168.130.58) GET /ui HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)
[16/May/2019:11:31:47 +0200] 401 -(192.168.130.58) GET /favicon.ico HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)

"

I don’t know what the 401 means after the date and time maybe a line number but the rest of that is just saying your computer which has an IP address of 192.168.130.58 browser Firefox version 66 is making a request which is just basic info. This is not the log data we need.

To get the startup code flow where is most likely where the error will be hiding restart your Node red addon and then keep clicking the refresh in the log and you will see node red going through the loading process when it stops loading say up to 5 mins then copy and paste the log again.

ps the character for getting code format is not the quotation marks " it is three back ticks ` together, on my keyboard (qwerty US) it is at the top left of the keyboard to the left of the number 1 (you can see under point 11 here)

For the 401 isn’t it the 401 Unauthorized code?

Yer I thought of that after. I was going to see if he came back with more log data and then go from there.

1 Like

Hello

Thanks for your patience ! There is nothing suspicious in the NR logs, just some unconfigured node.
Just when I try to login I have the same log entry.

16 May 15:34:48 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
**16 May 15:34:48** - [error] [function:Generate list] TypeError: Cannot read property 'length' of undefined
**[16/May/2019:15:36:53 +0200]** 401 -(192.168.130.58) GET / HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)
[16/May/2019:15:37:05 +0200] 401 -(192.168.130.58) GET / HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)

What I noticed in the log anyway, is the different time format, maybe that is the problem. Any thoughts ?

Thanks again.

:tada: Release v3.1.0

Full Changelog

:tada: A packed Node-RED, with a bunch of package & system updates, including the Home Assistant Websocket node.

:sparkles:Node-RED Dashboard (UI) is now shipped by this add-on by default and has been patched to work better with Ingress.

:ambulance: The issue with ARM 64-bits is resolved. Which mean that the aarch64 architecture now also works.

:ambulance: The issue with accessing HTTP nodes has been addressed. HTTP endpoints are now freely available when using the /endpoint/ URL prefix. Please take that into account when using this.

:wrench: Direct access is now enabled by default. This is needed for HTTP nodes and Node-RED Dashboard as well.

:hammer: Changes

  • :arrow_up: Upgrades python to 2.7.16-r1
  • :arrow_up: Upgrades lua-resty-http to 0.13-r0
  • :arrow_up: Upgrades nginx to 1.14.2-r1
  • :arrow_up: Upgrades nginx-mod-http-lua to 1.14.2-r1
  • :arrow_up: Updates node-red-contrib-home-assistant-websocket to v0.11.0 (#219)
  • :ambulance: Turns of Lua Resty core in Nginx
  • :arrow_up: Updates node-red-node-serialport to v0.8.3 (#220)
  • :wrench: Adds configuration to allow http_node access (#214)
  • :sparkles: Adds Node-RED Dashboard
  • :ambulance: Allow for bigger file uploads during import
  • :warning:Adds warning to logout when using the Dark theme
  • :books:Adds known issues and limitation section to documentation
  • :rotating_light:Patches Denial of Service vulnerability in Axios package (#221)
  • :pushpin: Pin snyk to 1.165.1 (#222)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Great job… love this addon!
Only started using it recently and almost converted all my automations to node-red.

Thanks :beers:

Thank you for creating this amazing add-on. I’m interested in using !secret for the add-on config but don’t know how. For e.g. should I just use: “credential_secret”: “!secret node_red_crediential”

Also, I experienced the 502 Bad gate way with the following config and there’s no error in the log.
{
“credential_secret”: “xxxxxxx”,
“dark_mode”: false,
“http_node”: {
“username”: “xxxx”,
“password”: “xxxx”
},
“http_static”: {
“username”: “xxxx”,
“password”: “xxxx”
},
“ssl”: false,
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”,
“require_ssl”: true,
“system_packages”: [],
“npm_packages”: [],
“init_commands”: []
}

[Updated] It just magically works now. I guess I should be bit more patient. So all I want to learn now is how to use !secret in the config. Thanks!

Thanks for taking on board the comments/request for NR dashboard!
Enjoy your coffee’s :wink:

:tada: Release v3.1.1

Full Changelog

:ambulance: Small bugfix release, addressing an issue when using direct access + SSL enabled and having the certificates stored in a subfolder.

:hammer: Changes

  • :ambulance: Fixes path handling in certificates (#225) (@troykelly)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Hi

I still have the same login cycle problem as before. Here it is the hssio log

‘19-05-20 06:31:19 INFO (MainThread) [hassio.api.proxy] Home Assistant WebSocket API request running
19-05-20 06:50:58 INFO (MainThread) [hassio.auth] Auth request from a0d7b954_nodered for zoli
19-05-20 06:50:58 WARNING (MainThread) [hassio.auth] Wrong login from zoli
19-05-20 06:51:06 INFO (MainThread) [hassio.auth] Auth request from a0d7b954_nodered for zoli
19-05-20 06:51:07 WARNING (MainThread) [hassio.auth] Wrong login from zoli
19-05-20 06:51:39 INFO (MainThread) [hassio.auth] Auth request from a0d7b954_nodered for zoli
19-05-20 06:51:39 WARNING (MainThread) [hassio.auth] Wrong login from zoli’

What I have detected is that the hassio supervisor is using UTC time settings which is 2 hours behind my tme in homeassistant. This can’t be the source of the problem ?
I tried the soulution recommended by frenck, without success.
I use the credentials I gave in the node red addon config.

Please, help
Thanks a lot

I found the solution !
I have to use the following address : https://******.duckdns.org:1880/endpoint/ui/

Thanks for the great work !

1 Like

I’ running node red 3.1.1 (latest) addon on an rpi Hassio. Yesterday when I deployed the loading icon just looped. Then I tried closing the addon and login again and now I’m stuck on that loading loop when trying to access node red. Tried private mode, clearing site cache, clearing local storage.

The only strange thing I noticed in my NR log is this

nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)

Anyone know how to solve this? No automation is working so it’s not just that I cant reach the UI, it’s just down. Here is my config

{

    "credential_secret": "myoldpreingresspassword",

    "dark_mode": false,

    "http_node": { "username": "", "password": "" },

    "http_static": { "username": "", "password": "" },

    "ssl": false,

    "certfile": "fullchain.pem",

    "keyfile": "privkey.pem",

    "require_ssl": true,

    "system_packages": [],

    "npm_packages": [],

    "init_commands": [],

    "port": 1880,

    "log_level": "info" }
2 Likes

@frenck is it possible to install a node with canvas dependencies, I’m not sure of the permission levels of Node-RED addon this is the log output

> [email protected] install /opt/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp ERR! UNCAUGHT EXCEPTION 
node-pre-gyp ERR! stack Error: Cannot find module 'minizlib'
node-pre-gyp ERR! stack     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
node-pre-gyp ERR! stack     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
node-pre-gyp ERR! stack     at Module.require (internal/modules/cjs/loader.js:637:17)
node-pre-gyp ERR! stack     at require (internal/modules/cjs/helpers.js:22:18)
node-pre-gyp ERR! stack     at Object.<anonymous> (/opt/node_modules/tar/lib/pack.js:28:14)
node-pre-gyp ERR! stack     at Module._compile (internal/modules/cjs/loader.js:689:30)
node-pre-gyp ERR! stack     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
node-pre-gyp ERR! stack     at Module.load (internal/modules/cjs/loader.js:599:32)
node-pre-gyp ERR! stack     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
node-pre-gyp ERR! stack     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
node-pre-gyp ERR! System Linux 4.15.0-47-generic
node-pre-gyp ERR! command "/usr/bin/node" "/opt/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /opt/node_modules/canvas
node-pre-gyp ERR! node -v v10.14.2
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! This is a bug in `node-pre-gyp`.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR!     <https://github.com/mapbox/node-pre-gyp/issues>
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the [email protected] install script.

Please see the add-on documentation on that. It allows you to install custom system & npm packages to fulfil those dependency requirements.

1 Like