Node.js server not able to access certificate if not renewed

Im running a nodejs server on my pc with nodemon, yesterday after getting my cert it worked fine. Now, after closing my pc, im trying to run my server.js file again, and the following code:

const https = require('https');
const fs = require('fs');
const options = {
key: fs.readFileSync('C:/Certbot/live/learntocode.ddns.net/privkey.pem'),
cert: fs.readFileSync('C:/Certbot/live/learntocode.ddns.net/fullchain.pem'),
};

Error: EPERM: operation not permitted, open 'C:/Certbot/live/learntocode.ddns.net/fullchain.pem'
This is the error i get. I tried changing file access permissions on file explorer but i get: Failed to enumerate objects in the container. Weirdly enough, when i rerun certbot certonly and replaced by certs, Nodejs ran my .js file without error

My domain is: learntocode.ddns.net

My web server is (include version):
Nodejs v18.14.2

The operating system my web server runs on is (include version):
Windows 11 v22h2

My hosting provider, if applicable, is:
no-ip

I can login to a root shell on my machine (yes or no, or I don't know):
I dont know

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
2.7.4

That is probably related to the permissions on either the symlink or its target files. Make sure you are running within the same permission scope each time.

More importantly, if you are just starting with certbot on windows you should probably switch to a different windows Acme client. Support for certbot on windows is discontinued soon per below

4 Likes

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