aacerox / node-rest-client

REST API client from node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

self signed certificate error when calling https end point

gurupraveen-avvaru opened this issue · 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

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

where exactly this configuration needs to be edited?

@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

Hey @ranupoju0126

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

@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.

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