node-ytdl-core icon indicating copy to clipboard operation
node-ytdl-core copied to clipboard

(node:557) UnhandledPromiseRejectionWarning: Error: unable to get local issuer certificate

Open RobKohr opened this issue 2 years ago • 3 comments

I just installed with npm install ytdl-core@latest, created an index.js that contains the "Usage" example in the readme, and ran

 % node index.js
(node:557) UnhandledPromiseRejectionWarning: Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1515:34)
    at TLSSocket.emit (events.js:400:28)
    at TLSSocket._finishInit (_tls_wrap.js:937:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:709:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:557) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:557) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

RobKohr avatar Jun 15 '23 23:06 RobKohr

looks like a problem with your local certificate chain other tools like youtubedl and maybe even chrome should have similar problems sorry but we can't help you with that

TimeForANinja avatar Jul 14 '23 05:07 TimeForANinja

Same problem here, and I'm able to use other tools like youtube-dl, chrome , curl, or even a fetch inside NodeJS.

silvioprog avatar Feb 17 '24 01:02 silvioprog

@RobKohr, in my case, I solved the problem by disabling the NODE_TLS_REJECT_UNAUTHORIZED, for example: NODE_TLS_REJECT_UNAUTHORIZED=0 yarn run start.

My env:

  • Apple M1 Pro with Sonoma 14.3.1
  • Node v18.18.2
  • Credits StackOverflow

silvioprog avatar Feb 17 '24 01:02 silvioprog