解决火绒 6.0 造成的 Node.js fetch 方法 unable to verify the first certificate 报错
原文约1000字,阅读约需3分钟。发表于: 。之前用 Electron 写了一个监控客户端,昨天突然用不成了,检查日志发现这样的一个报错: 123456789101112Error occurred in handler for 'getPrice': TypeError: fetch failed at Object.fetch (node:internal/deps/undici/undici:12293:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async WebContents.<anonymous> (node:electron/js2c/browser_init:2:78167) { cause: Error: unable to verify the first certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1659:34) at TLSSocket.emit (node:events:514:28) at TLSSocket._finishInit (node:_tls_wrap:1070:8) at ssl.onhandshakedone (node:_tls_wrap:856:12) { code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }}
文章讲述了作者使用Electron编写的监控客户端突然无法使用的问题。通过检查日志,发现是调用Node.js的fetch方法时遇到了证书问题。经过查找,发现是火绒的根证书不被Node.js信任,关闭了火绒的加密连接扫描设置后,问题得到解决。