Sorry for the late reply, but I had overlooked your question.
I don't see at first sight what could cause this error. It is occurs at line 238 in the red.js file:
So what happens when your httpsRefreshInterval timer is executed:
- Line 235: The contents of your privkey.pem file are read (via your readFileSync command), to get your private key.
- Line 235: Also the contents of your fullchain.pem file are read (via your readFileSync command), to get your corresponding certificate.
- We only arrive at line 238 if both file exists and have been read.
- Line 238: it is checked whether you have already a
server.key. Which means Node-RED checks whether the NodeJs http(s) server has already a private key. If there was previously no key used in your NodeJs http(s) server, then the key from your privekey.pem file should be used anyway.
- Line 238: it is also checked whether your current private key (refreshedHttps.key) is equal to the server.key. Which means Node-RED checks whether the key that the NodeJs http(s) server currently uses is equal to the key from your privkey.pem file. Because we only update the private key in the NodeJs http(s) server when that key has changed.
In your case step 5 fails. Which means the server.key is not undefined, but I assume it is not a string (like we expected).
My first thought was that perhaps in a recent NodeJs version, the server.key mechanism has changed an it now returns a function or a promise or ... But when I look at the NodeJs code, I don't immediately see something different (like a wrapper function or something like that)
Can you give some more information:
- Your NodeJs version (from your Node-RED startup log)
- How you created your private key