Home > Blockchain >  tunneling socket could not be established, EPROTO 139829749196736
tunneling socket could not be established, EPROTO 139829749196736

Time:01-06

I am facing the issue while calling Node js application from server, "Error: tunneling socket could not be established, cause=write EPROTO 139829749196736:error:1408F10B:SSL routines:ssl3_get_record:wrong version"

I used this code snippet below:

 var options = {
                'method': "POST",
                'url': process.env.QATAPIPATH   process.env.APIPATH   parameter,
                'headers': {
                    'Content-Type': 'application/json'
                },
                ignoreTLS: true,
                secure: false,
                body: JSON.stringify({
                    "data": req.body.data
                })
            };

CodePudding user response:

The above SSL errors are thrown because the client is not able to verify the trust chain of the self-signed server certificate

The easiest solution to resolve these errors is to use the “rejectUnauthorized”

> https.request({ 
>       ....,
>       rejectUnauthorized: false,
>     }, ...)

or set it as an environment variable

NODE_TLS_REJECT_UNAUTHORIZED=0

for Linux

export NODE_TLS_REJECT_UNAUTHORIZED=0
  • Related