Node.js grpc错误SSL23\u获取\u服务器\u您好
使用Ubuntu 16.04在一个流浪的虚拟机中工作 我以前能够使用Google的Dialogflow API检测意图,但现在它在我的新VM中抛出一个错误 步骤:Node.js grpc错误SSL23\u获取\u服务器\u您好,node.js,ssl,proxy,dialogflow-es,Node.js,Ssl,Proxy,Dialogflow Es,使用Ubuntu 16.04在一个流浪的虚拟机中工作 我以前能够使用Google的Dialogflow API检测意图,但现在它在我的新VM中抛出一个错误 步骤: Auth error:Error: write EPROTO 140436597872448:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827 { "path
Auth error:Error: write EPROTO 140436597872448:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827
{
"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": []
}
}
}
npm i对话框流
export GOOGLE\u APPLICATION\u 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
{
"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": []
}
}
}
调试:
Auth error:Error: write EPROTO 140436597872448:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827
{
"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": []
}
}
}
证书位于它们的默认位置/etc/ssl/certs/ca Certificates.crt
,我知道NodeJS正在使用它们,因为NODE\u EXTRA\u ca\u certs=/etc/ssl/certs/ca-Certificates.crt${df test over}
说:
(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
请求:
Auth error:Error: write EPROTO 140436597872448:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827
{
"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
域。。。我被误导了,认为这个问题是由我的新流浪汉虚拟机的错误配置引起的。我想这可能会对你有所帮助,谢谢你的建议。如果我使用的是https
包,这可能会起作用,但是DF客户端使用的是grpc
,您能更好地解释这个问题吗?