Node-RED Credentials could not be decrypted

I installed Node Red from the Community Add on store and set the credential secret, but I keep getting an error when I open Node Red. I haven’t actually created anything in Node Red yet.
Credentials could not be decrypted
node_red_error

Here’s my configuration

credential_secret: notMyRealPassword
dark_mode: false
http_node:
  username: ''
  password: ''
http_static:
  username: ''
  password: ''
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
require_ssl: false
system_packages: []
npm_packages: []
init_commands: []

Here’s the log

 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 6.3.0
 You are running the latest version of this add-on.
 System: Ubuntu 18.04.4 LTS  (amd64 / intel-nuc)
 Home Assistant Core: 0.112.2
 Home Assistant Supervisor: 228
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] node-red.sh: executing... 
patching file nodes/ui_base.html
Hunk #1 succeeded at 1177 (offset 646 lines).
up to date in 0.431s
found 0 vulnerabilities
[cont-init.d] node-red.sh: exited 0.
[cont-init.d] user.sh: executing... 
[cont-init.d] user.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[05:56:46] INFO: Starting Node-RED...
> addon-node-red@ start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
7 Jul 05:56:47 - [info] 
Welcome to Node-RED
===================
7 Jul 05:56:47 - [info] Node-RED version: v1.0.6
7 Jul 05:56:47 - [info] Node.js  version: v12.15.0
7 Jul 05:56:47 - [info] Linux 4.15.0-108-generic x64 LE
7 Jul 05:56:47 - [info] Loading palette nodes
7 Jul 05:56:48 - [info] Dashboard version 2.22.1 started at /endpoint/ui
Traceback (most recent call last):
  File "/opt/node_modules/node-red-node-pi-gpio/testgpio.py", line 4, in <module>
    import RPi.GPIO as GPIO
  File "/usr/lib/python2.7/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!
7 Jul 05:56:48 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
7 Jul 05:56:48 - [info] Settings file  : /etc/node-red/config.js
7 Jul 05:56:48 - [info] Context store  : 'default' [module=memory]
7 Jul 05:56:48 - [info] User directory : /config/node-red/
7 Jul 05:56:48 - [warn] Projects disabled : editorTheme.projects.enabled=false
7 Jul 05:56:48 - [info] Flows file     : /config/node-red/flows.json
7 Jul 05:56:48 - [info] Server now running at http://127.0.0.1:46836/
7 Jul 05:56:48 - [warn] Error loading credentials: SyntaxError: Unexpected token   in JSON at position 0
7 Jul 05:56:48 - [warn] Error loading flows: Error: Failed to decrypt credentials
7 Jul 05:56:48 - [info] Starting flows
7 Jul 05:56:48 - [info] Started flows
[05:56:49] INFO: Starting NGinx...
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)

The unexpected token in JSON line is interesting. When I put the secret in quotes, they get removed. If I’m not mistaken, the config editor is YAML, not JSON, so maybe something is going wrong with a conversion?

I did disable SSL since I don’t have that setup and I am running Hassio in docker on Ubuntu.

I think the problem was that I had installed the Node-Red Add on a couple months ago then uninstalled it. I assumed that would remove all the files. When I installed it again recently, I put in a new credential_secret and it was telling me that would mess up my old flows. When I went into Node-Red I realized the flow there was one I created a couple months ago. I deleted the old flow, setup some new ones and the next time I restarted the Add on, I didn’t get any errors. Looks like things are good now.

1 Like