NodeRED ENOENT error when trying to reading the Certificate files


I get the following error when I try to enable the 'HTTPS' option in settings.js

Error loading settings file: /data/settings.js
Error: ENOENT: no such file or directory, open '/home/user/Certificates/key.pem'
at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at Object. (/data/settings.js:94:26)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/usr/src/node-red/node_modules/node-red/red.js:140:20) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/user/Certificates/key.pem'

Steps completed so far

  1. Ensure directory and file exists (cat /home/user/Certificates/key.pem)
  2. Permissions (chmod 777)
  3. Absolute and relative paths
  4. Different folders
  5. File renames

Please stop and start NR and then copy and paste the output from the start command to the line where it says:
6 Mar 16:34:42 - [info] Started flows
(and your date and time will be different)

It NR really running under the user 'user'?

Also, is this a Docker install? If so, code running inside the docker container can only see those parts of the host file system that are made available to it, so by default it will not be able to see the users home folder

Please see the attached.

I've relocated the certificates inside the _data folder and is running the container from the root user(for validation)

Yes, it's a docker install. I moved the files inside the _data folder and still get the same error.

You have to refer to it by its location within the docker environment, not the location from the external environment.
Since you don't seem to know a great deal about docker are you sure you want to use it? It is often much simpler to do a native install of node-red rather than a Docker install, as you are finding out.

Unfortunately not :frowning:

Where have you put them relative to where settings.js is? You can see in the log that this is referenced by /data/settings.js.

In the same folder - /var/lib/docker/volumes/node_red_data/_data/

Please don't post screenshots, copy/paste instead, it is much easier to read.

Well if it is in that folder then, since settings is /data/settings.js (as you can see from the log) then presumabley it is /data/whatever-it-is-called.

That did the trick!

I had it /_data/ instead of /data

As you said, I presume the absolute path is outside the container environment!

Thank you soo much :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.