question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

using a self-signed certificate results in a request error

See original GitHub issue

I use to self signed certificate for dev. In node code I try to get some recources from the same domain on another port

import request from 'superagent';
...
const key = fs.readFileSync('certs/server.key');
const cert = fs.readFileSync('certs/server.crt');
....
       try {
            const agent = request.agent();
            const response = await agent
                .get(runtimeUrl)
                .key(key)
                .cert(cert)
                .buffer(true);

            return response.text;
        } catch (error) {
            logError(error);
        }

but get error:

Error: unable to verify the first certificate
[1]     at TLSSocket.onConnectSecure (_tls_wrap.js:1060:34)
[1]     at TLSSocket.emit (events.js:182:13)
[1]     at TLSSocket._finishInit (_tls_wrap.js:639:8) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE', response: undefined }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
budarincommented, May 16, 2018

Thanks! It helped!

0reactions
budarincommented, May 16, 2018

I’m sorry - I have found solution: instead of using IP it should be used machine name! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Simple Explanation of SSL Certificate Errors & How to Fix ...
This error indicates that the SSL certificate is signed or approved by a company that the browser does not trust. That means either...
Read more >
using a self-signed certificate results in a request error #1376
I use to self signed certificate for dev. In node code I try to get some recources from the same domain on another...
Read more >
Ignore invalid self-signed ssl certificate in node.js with https ...
ERROR: certificate common name `Linksys' doesn't match requested host name `192.168.1.1'. To connect to 192.168.1.1 insecurely, use `--no-check-certificate'.
Read more >
iOS 11 HTTPS network request failure with self-signed cert
For testing purpose, we use a self-signed cert, loaded as a bundle resource for network requests. It works fine on Xcode8 + iOS10...
Read more >
HTTP Connector | Error: self signed certificate in certificate ...
A possible reason is that the certificate Issuer is not a trusted certificate authority.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found