help icon indicating copy to clipboard operation
help copied to clipboard

Node v18+ - TLS - local issuer problem

Open DesmoGiec opened this issue 2 years ago • 5 comments

Details

Hello :) I'm trying to run a discordjs over nodejs on my webhost, but I'm having an issue. With nodejs v16 all works perfectly. discordjs requires nodejs 16.1+, I'm on 16.2 so no problem at all, for now. But for the future I'd like to update nodejs, but here's the issue. When I try to run the app, I got this error:

[Discord (18)] [pcdjkska@hostingssd84 Bot]$ node index
Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket._finishInit (node:_tls_wrap:959:8)
    at ssl.onhandshakedone (node:_tls_wrap:743:12) {
  code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
}

I've tried with disabling ssl in strict-ssl npm cmd, tried to generate CA certs and use NODE_EXTRA_CA_CERTS... Nothing worked. I have no clues, hope somebody can help me figuring out what's wrong.. Thanks in advance. Mirko

Node.js version

v16 ok, from 18 the issue shows up.

Example code

No code. Even with an empty index.js the issue shows up. Just by doing node index.js it triggers

Operating system

It's a unix webhost, cPanel present.

Scope

runtime

Module and version

Not applicable.

DesmoGiec avatar Sep 01 '23 22:09 DesmoGiec

Can you run uname -a on your webhost and share the output

preveen-stack avatar Sep 02 '23 07:09 preveen-stack

[pcdjkska@hostingssd84 ~]$ uname -a Linux hostingssd84.netsons.net 3.10.0-962.3.2.lve1.5.77.el7.x86_64 #1 SMP Mon Dec 12 07:06:14 EST 2022 x86_64 x86_64 x86_64 GNU/Linux

DesmoGiec avatar Sep 02 '23 07:09 DesmoGiec

Are you using any self signed cerificates

preveen-stack avatar Sep 10 '23 04:09 preveen-stack

I've used Let's Encrypt, which is implemented in cPanel, so it's not self signed. When browsing the site, the lock icon shows up, and it's reported that "verified by: Let's Encrypt" Crypted connection, TLS_AES_128_GCM_SHA256, 128bit keys, TLS 1.3

DesmoGiec avatar Sep 10 '23 10:09 DesmoGiec

I got the same problem, thanks for any advice

depdui avatar Mar 12 '24 13:03 depdui