我正在研究一个dialogflow POC,在其中尝试调用DialogFlow提供的 v2 API。尝试提供here的NodeJS代码示例时,出现以下错误
{ Error: EHOSTUNREACH undefined: Getting metadata from plugin failed with error: request to https://www.googleapis.com/oauth2/v4/token failed, reason: connect EHOSTUNREACH 0.0.38.172:80 - Local (192.168.0.103:51468)
at Object.callErrorFromStatus (/Users/devuser/Development/workspaces/df-poc/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
at Http2CallStream.call.on (/Users/devuser/Development/workspaces/df-poc/node_modules/@grpc/grpc-js/build/src/client.js:96:33)
at Http2CallStream.emit (events.js:203:15)
at process.nextTick (/Users/devuser/Development/workspaces/df-poc/node_modules/@grpc/grpc-js/build/src/call-stream.js:75:22)
at process._tickCallback (internal/process/next_tick.js:61:11)
code: 'EHOSTUNREACH',
details:
'Getting metadata from plugin failed with error: request to https://www.googleapis.com/oauth2/v4/token failed, reason: connect EHOSTUNREACH 0.0.38.172:80 - Local (192.168.0.103:51468)',
metadata: Metadata { internalRepr: Map {}, options: {} } }
我已导入GOOGLE_APPLICATION_CREDENTIALS
,并将环境变量指向凭据。如果我尝试使用Authorization标头的REST API路由,则调用工作正常。
请让我知道这里是否缺少某些东西。
答案 0 :(得分:1)
这意味着EHOST
(您请求的文件的远程主机)不可访问。它们已关闭,或者由于某些其他限制(例如位置),您的计算机无法访问它们,可以使用VPN来解决。