Copying everything between two NR instances

I know, but I have checked flows_cred.json and settings.js and nothing is wrong there.
When the log is saying Error loading credentials: where (which file) is it coming from?

The error I got had a "rectangle" character on the error (the one when the font is missing the actual character).

Edit: the JSON file also looked alright using cat but of course I cannot know if it had some corrupted bits or something.

Edit 2: I don't want to hijack the thread but it's still unclear to me where the password asked on the project settings is stored and/or if it will use the one in settings.js?

Ah, if the credentials file looks like valid JSON, that yes, I've misinterpreted that error message.

On the original system, had you set credentialSecret and done at least one deploy before you started copy things over? If you had just set credentialSecret and then started copy over without doing the deploy, then the credentials file will still be encrypted with the generated secret.

So, on the original system, set credentialSecret in your settings file, then make any change in the editor to cause the Deploy button to be active and then press it. The runtime will then re-encrypt the credentials using your secret.

Then copy the newly generated credentials file over.

Project credential keys are stored in the project settings in ~/.node-red/.config.json.

1 Like

The flows_cred.json looks like {"$":"2e8c148f4416d...cAtx48="} (so OK JSON) and yes, I have deployed many times with the credentialSecret being the 'correct' value on the source system.

Okay, so lets rule out some of the possible causes...

Check the startup log of the second instance to ensure it is definitely loading the settings file you think it is - and that settings file has the exact same credentialSecret property set in it.

Double check that again... the majority of issues like this are caused by modifying the wrong settings file.

Looks like it is:

11 Sep 20:51:27 - [info] Settings file : /data/settings.js

11 Sep 20:51:27 - [info] Context store : 'default' [module=memory]

11 Sep 20:51:27 - [info] User directory : /data

11 Sep 20:51:27 - [warn] Projects disabled : editorTheme.projects.enabled=false

11 Sep 20:51:27 - [info] Flows file : /data/flows.json

11 Sep 20:51:27 - [info] Server now running at

11 Sep 20:51:27 - [warn] Error loading credentials: SyntaxError: Unexpected token L in JSON at position 0

11 Sep 20:51:27 - [warn] Error loading flows: Error: Failed to decrypt credentials

And in /data/settings.js the credentialSecret is the same...

OS language settings are the same right? Both set to en_US-UTF-8 or such? If these are different you can get a mismatch on credentials encoding.

Really? Have you experienced this? It'd sound to me like a bug if so..

Both are docker instances with something like:

   docker run -it -p 1880:1880 -v /Users/xyz/Docker/NodeRed:/data --name nodered nodered/node-red

So, it should. No?
One is running on a debian VM. This other on a Mac.

Nope it can happen, I had a Pi that was en_GB and another that was en_US, passwords that were simple worked. Passwords that had complex/odd characters, did not work across the two systems. Just so happened one character in the password as transposed differently per language setting for OS. When I changed pi password from raspberry to my normal complex animal for a password... I just happened to trigger the issue. Morale of the story... set the environmental settings in raspi-config consistently, before you cache any passwords! LOL.

Maybe change the passwords to something dirt simple that is below ascii 127.... for just alphanumeric characters as a test, and see if that resolves the issue?

I would also run the JSON file in a validation filter, there are websites that can do that for you. Clearly there is something that is choking encode or decode sequence, or odd thing in the JSON file. The log states it out right it is choking on the JSON file because of something..

That why so many tools are moving to UTF coding of course.

Let the insanity stop! Let the insanity stop! Let the insanity stop! Let the insanity stop!

Oh, you said moving to UTF? I feel better now. [Too much? LOL]

The file is fine. The code has tried to decode the credentials, and expects to get a JSON string at the end of it. The error is because the result of the decoding is not JSON.

@greengolfer At this point on a Friday evening, I've run out of suggestions on the issue.

So output result not file its self. "there is something that is choking encode or decode sequence, or odd thing in the JSON file" Gotcha.

It is already the case... Uppercase, lowercase, numbers. Nothing more.

No problem. It was my case too. And on Saturday morning I am going to start digging again.

Perhaps after having the "cloned" container started the first time, copy all the files (including hidden ones) from the data folder and run some diff tool against the data folder of the original. This way you should be able to spot the issue quite easily if it's due to some difference between them (like I would suspect).

If going to do this, just ignore the node_modules dir as comparing it will likely be useless and take a lot of time.

1 Like

One other thought - what tool did you use to do the copy?

Is it too much to ask, that your recreate your 2nd instance from scratch, and work through the steps to establish to see if the issue occurs again? At the very least validate the process as identical to the first instance.

I believe you said one instance is Macintosh but the other is not? Do I recall right? I have just yesterday, started to setup a NR instance on PC/Debian 10 (in a VM) as practice to doing same on physical hardware in due course. Whereas everything before this has been strictly on Pi devices. I wonder what interesting issues I might encountered, given your experience thus far.

It really should "just work". I'm almost certain there's just some small thing missing in this case. :slightly_smiling_face: