node-red: After a stop or palette update, start blocked at "Error loading flows: Error: Failed to decrypt credentials"
Since 0.18.0
- It occurred several times after an update of Palettes.
- Sometimes after a CTRL-C and “
node-red -v
” (I am on Windows)
Here are the logs:
5 Feb 16:46:50 - [info] Node-RED version: v0.18.0
5 Feb 16:46:50 - [info] Node.js version: v6.9.1
5 Feb 16:46:50 - [info] Windows_NT 6.1.7601 x64 LE
5 Feb 16:46:52 - [info] Loading palette nodes
5 Feb 16:46:56 - [warn] ------------------------------------------------------
5 Feb 16:46:56 - [warn] [node-red/rpi-gpio] Info : Ignoring Raspberry Pi specific node
5 Feb 16:46:56 - [warn] [node-red/tail] Not currently supported on Windows.
5 Feb 16:46:56 - [warn] ------------------------------------------------------
5 Feb 16:46:56 - [info] Settings file : \Users\paborsch\.node-red\settings.js
5 Feb 16:46:56 - [info] User directory : \Users\paborsch\.node-red
5 Feb 16:46:56 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
5 Feb 16:46:56 - [info] Flows file : \Users\paborsch\.node-red\flows_LG5Z5D72.json
5 Feb 16:46:56 - [info] Server now running at http://127.0.0.1:1880/
5 Feb 16:46:56 - [debug] loaded flow revision: 38e2f168f032cb645c74aa74c9d8626a
5 Feb 16:46:56 - [debug] red/runtime/nodes/credentials.load : no user key present
5 Feb 16:46:56 - [debug] red/runtime/nodes/credentials.load : using default key
5 Feb 16:46:56 - [debug] red/runtime/nodes/credentials.load : keyType=system
5 Feb 16:46:56 - [warn] Error loading credentials: SyntaxError: Unexpected token � in JSON at position 0
5 Feb 16:46:56 - [warn] Error loading flows: Error: Failed to decrypt credentials
In order to make it work again, I have to delete the credential file, launch it again and enter all the cred again !!! (Twitter, openweather, Rainbow, Facebook) …
I also tried to use the credential backup file, but same error.
And the cred file looked well (nothing weird at position 0)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 16 (5 by maintainers)
Anybody struggling with this, my solution was to remove
flows_cred.json
and restartWe’re working on upgrading our customers from 0.17.5 to 0.18.4 with no project features, but running into similar snags related to credentials:
In FRED, we set an environment variable to the instance’s credentials key when we create our docker container. This is configured in settings.js by setting the secret to process.env.CREDENTIALS_SECRET (or similar).
When we upgraded a few instances on our test system to 0.18.4 from 0.17.5 we sometimes see the new error message, and a “Setup Credentials” button with “project settings” tab with no content inside. Note that the error message refers to project functionality, even when projects are disabled.
So far this happens only in a few cases, and we’re not sure what’s caused this. We have tried a number of things to get Node-RED to read the credentials file, but no luck.
We’re pretty convinced the secret we supply is the same and the credentials file hasn’t changed, however once this error appears, the credentials file cannot be decrypted even if we roll back to 0.17.x or older. Not completely sure since old versions didn’t come up with an error in the UI, and allowed flows to run. Still looking into it.
We’re struggling to get to the bottom of this, but will keep you posted. Regarding the error box, our suggestion is to remove the references to projects functionality when the feature is disabled, and provide an option to create a new credentials file in case the credentials are no longer readable, otherwise, it’s not possible to re-enter credentials and start flows without resorting to the command line.