Categories
JavaScript Answers

How to fix Node.js https pem error: routines:PEM_read_bio:no start line?

Spread the love

To fix Node.js https pem error: routines:PEM_read_bio:no start line,. we read the SSL key and certificate file.

For instance, we write

const options = {
  key: fs.readFileSync("./key.pem", "utf8"),
  cert: fs.readFileSync("./server.crt", "utf8"),
};

to read key and cert files with readFileSync.

key is the key file.

And cert is the certificate file.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.