This API no longer works
Closed this issue · 2 comments
Please update the package
Error: unable to verify the first certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1535:34) at TLSSocket.emit (node:events:513:28) at TLSSocket._finishInit (node:_tls_wrap:949:8) at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:730:12) { code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE', config: { url: 'https://pt.akinator.com', method: 'get', headers: { Accept: 'application/json, text/plain, */*', 'User-Agent': 'axios/0.21.4' },
And proxyOptions rejectUnauthorized does not work. And this error is being logged internal (cannot be catch in try/catch)
The API does still work, however as of right now its intermediate certificates have been installed incorrectly.
To install these yourself and fix the problem temporarily:
- Install
node_extra_ca_certs_mozilla_bundle
from NPM. - Add the following to the top-most part of your code (ensuring that this runs before anything else):
const fs = require('fs');
const https = require('https');
https.globalAgent.options.ca = fs.readFileSync('node_modules/node_extra_ca_certs_mozilla_bundle/ca_bundle/ca_intermediate_root_bundle.pem');