node-rest-client icon indicating copy to clipboard operation
node-rest-client copied to clipboard

self signed certificate error when calling https end point

Open gurupraveen-avvaru opened this issue 7 years ago • 6 comments

Hi Team,

I am calling https end point using node-rest-client, I am getting below error.

events.js:137 throw er; // Unhandled 'error' event ^

Error: self signed certificate in certificate chain at TLSSocket.onConnectSecure (_tls_wrap.js:1041:34) at TLSSocket.emit (events.js:160:13) at TLSSocket._finishInit (_tls_wrap.js:638:8)

Please let me know how to fix this issue.

--Guru

gurupraveen-avvaru avatar Feb 23 '18 04:02 gurupraveen-avvaru

I am also having the same issue, there is temporary solution to add rejectUnauthorized as false, which is not safe,

I did find the options in documentation, but still same error occurs image

ranupoju0126 avatar May 10 '18 22:05 ranupoju0126

where exactly this configuration needs to be edited?

pranavtheway avatar May 11 '18 08:05 pranavtheway

@gurupraveen-avvaru Hope you have that self signed certificate .crt file convert that .crt file to .pem file using the following command openssl x509 -inform DER -outform PEM -in server.crt -out server.pem

then use give the path of that .pem file in options var options = { user:xxxxxx password: xxxxxx, connection: { ca:fs.readFileSync('/Users/xxxx/WebstormProjects/project-Master/server/server.pem') }, }

Done! This will work for sure

ranupoju0126 avatar May 15 '18 16:05 ranupoju0126

Hey @ranupoju0126

Where can i get the .crt file and what configuration file we are talking about here?

pranavtheway avatar May 16 '18 06:05 pranavtheway

@pranavtheway .crt file you should get from the team who has done secure connections to the domain(https).

I am not sure about what configuration file you are talking about

Th only configuration I know is which I posted a screenshot in my previous comment.

teja12687 avatar May 16 '18 19:05 teja12687

i got this error using nodemailer and gmail as my demo account.. any solutions?

drizzyemtk54 avatar Aug 15 '18 12:08 drizzyemtk54