# Copying everything between two NR instances

**URL:** <https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710>\
**Category:** General\
**Created:** [10 September 2020 18:47 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710 "2020-09-10T18:47:56Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [11 September 2020 19:14 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/21 "2020-09-11T19:14:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [11 September 2020 19:16 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/22 "2020-09-11T19:16:42Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 September 2020 19:32 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/23 "2020-09-11T19:32:27Z")

</div>

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.

> [@ristomatti](#):
>
> 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` ?

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

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [11 September 2020 19:40 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/24 "2020-09-11T19:40:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 September 2020 19:44 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/25 "2020-09-11T19:44:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [11 September 2020 20:54 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/26 "2020-09-11T20:54:05Z")

</div>

Looks like it is:

```auto
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 http://127.0.0.1:1880/

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...

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [11 September 2020 20:57 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/27 "2020-09-11T20:57:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [11 September 2020 21:00 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/28 "2020-09-11T21:00:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [11 September 2020 21:02 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/29 "2020-09-11T21:02:54Z")

</div>

Both are docker instances with something like:

```auto
   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.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [11 September 2020 21:17 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/30 "2020-09-11T21:17:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [11 September 2020 21:22 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/31 "2020-09-11T21:22:21Z")

</div>

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..

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [11 September 2020 21:27 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/32 "2020-09-11T21:27:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [11 September 2020 21:34 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/33 "2020-09-11T21:34:58Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 September 2020 21:39 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/34 "2020-09-11T21:39:19Z")

</div>

> [@Nodi.Rubrum](#):
>
> The log states it out right it is choking on the JSON file because of something..

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.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [11 September 2020 21:41 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/35 "2020-09-11T21:41:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [12 September 2020 06:34 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/36 "2020-09-12T06:34:00Z")

</div>

> [@Nodi.Rubrum](#):
>
> 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?

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

> [@knolleary](#):
>
> At this point on a Friday evening, I've run out of suggestions on the issue.

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

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 07:49 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/37 "2020-09-12T07:49:26Z")

</div>

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](https://sourcegear.com/diffmerge/downloads.php) 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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 September 2020 10:20 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/38 "2020-09-12T10:20:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 September 2020 16:38 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/39 "2020-09-12T16:38:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 17:09 UTC](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710/40 "2020-09-12T17:09:59Z")

</div>

> [@Nodi.Rubrum](#):
>
> 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. 🙂

[Previous page](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710.md?page=1)

[Next page](https://discourse.nodered.org/t/copying-everything-between-two-nr-instances/32710.md?page=3)
