{ "headers": { "accept": "application/json,text/html,application/xhtml+xml,appli...
🚨 错误信息
{ "headers": { "accept": "application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7" }, "method": "GET", "uri": "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi", "gzip": true, "rejectUnauthorized": true, "followRedirect": true, "resolveWithFullResponse": true, "followAllRedirects": true, "timeout": 300000, "qs": { "db": "pubmed", "retmode": "text", "rettype": "medline", "retmax": "10000", "WebEnv": "MCID_68fedb8405072cd578065eca", "query_key": "1", "api_key": "sk-nRY0KCKCOXUFUr66dFLnY92jXcfzK3585KqkgnOweMIstU8m" }, "encoding": null, "json": false, "useStream": true }
🤖 AI解决方案
Error: unable to verify the first certificate
原因分析
SSL/TLS 证书验证失败。这通常发生在客户端(您的应用程序)无法验证服务器(eutils.ncbi.nlm.nih.gov)提供的 SSL 证书的有效性时。
解决方案
这是由于 Node.js(或其他运行代码的环境)的全局 CA 证书存储可能过时,或者您的网络环境(如代理服务器)干扰了证书验证过程。
临时解决方案(不推荐长期使用,仅用于快速调试):
在您的 Node.js 代码中,设置 NODE_TLS_REJECT_UNAUTHORIZED=0 环境变量。
bash
在运行您的 Node.js 应用前执行
export NODE_TLS_REJECT_UNAUTHORIZED=0
node your_app.js
推荐解决方案:
预防措施
NODE_TLS_REJECT_UNAUTHORIZED。这会使您的应用程序容易受到中间人攻击。