gpt4 book ai didi

node.js - grpc 错误 SSL23_GET_SERVER_HELLO

转载 作者:太空宇宙 更新时间:2023-11-03 13:21:47 24 4
gpt4 key购买 nike

在装有 Ubuntu 16.04 的 Vagrant 虚拟机中工作...

我以前能够使用 Google 的 Dialogflow API 检测意图,但现在它在我的新 VM 中抛出错误。

步骤:

  1. 创建 Dialogflow 项目
  2. 下载应用凭证 JSON
  3. npm i dialogflow
  4. export GOOGLE_APPLICATION_CREDENTIALS=/path/to/creds.json

    node -e '
    const dialogflow = require("dialogflow");
    const cli = new dialogflow.SessionsClient();
    const session = cli.sessionPath("df-project-id", "session-id");
    const request = { session, queryInput: { text: { text: "Hello" } } };
    cli.detectIntent(request).then(console.log, console.error);'

错误:

Auth error:Error: write EPROTO 140436597872448:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827

调试:

证书位于它们的默认位置 /etc/ssl/certs/ca-certificates.crt 我知道 NodeJS 正在使用它们因为 NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca -certificates.crt ${上面的 df 测试} 说:

(node:4067) Warning: Ignoring extra certs from '/etc/ssl/certs/ca-certificates.crt', load failed: error:0B07C065:x509 certificate routines:X509_STORE_add_cert:cert already in hash table

我看到请求还使用了在环境变量中声明的经过身份验证的代理:

http_proxy=http://user:pass@proxy:port
HTTP_PROXY=http://user:pass@proxy:port
https_proxy=http://user:pass@proxy:port
HTTPS_PROXY=http://user:pass@proxy:port

请求:

{
"pathname": "https://www.googleapis.com/oauth2/v4/token",
"nativeProtocols": {
"http:": {
"METHODS": [...],
"STATUS_CODES": {...},
"globalAgent": {
"domain": {
"domain": null,
"_events": {},
"_eventsCount": 1,
"members": []
},
"_events": {},
"_eventsCount": 1,
"defaultPort": 80,
"protocol": "http:",
"options": {
"path": null
},
"requests": {},
"sockets": {},
"freeSockets": {},
"keepAliveMsecs": 1000,
"keepAlive": false,
"maxSockets": null,
"maxFreeSockets": 256
}
},
"https:": {
"globalAgent": {
"domain": {
"domain": null,
"_events": {},
"_eventsCount": 1,
"members": []
},
"_events": {},
"_eventsCount": 1,
"defaultPort": 443,
"protocol": "https:",
"options": {
"path": null
},
"requests": {},
"sockets": {},
"freeSockets": {},
"keepAliveMsecs": 1000,
"keepAlive": false,
"maxSockets": null,
"maxFreeSockets": 256,
"maxCachedSessions": 100,
"_sessionCache": {
"map": {},
"list": []
}
}
}
},
"host": "proxy.*.com",
"port": "8080",
"hostname": "proxy.*.com",
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "axios/0.18.0",
"Content-Length": 734,
"host": "www.googleapis.com",
"Proxy-Authorization": "Basic *hash*"
},
"method": "post",
"path": "https://www.googleapis.com/oauth2/v4/token",
"maxBodyLength": 10485760,
"maxRedirects": 21,
"protocol": "https:",
"_defaultAgent": {
"domain": {
"domain": null,
"_events": {},
"_eventsCount": 1,
"members": []
},
"_events": {},
"_eventsCount": 1,
"defaultPort": 443,
"protocol": "https:",
"options": {
"path": null
},
"requests": {},
"sockets": {},
"freeSockets": {},
"keepAliveMsecs": 1000,
"keepAlive": false,
"maxSockets": null,
"maxFreeSockets": 256,
"maxCachedSessions": 100,
"_sessionCache": {
"map": {},
"list": []
}
}
}

最佳答案

安全团队在没有任何通知的情况下阻止了 googleapis.com 域...我误以为这个问题是由我的新 Vagrant VM 配置错误引起的。

关于node.js - grpc 错误 SSL23_GET_SERVER_HELLO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49301161/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com