我正在尝试创建我的第一个 Google Home Action,就像我的 Amazon Alexa 技能一样。这个动作的工作方式是,你执行一个意图,然后在我的代码中调用一个函数。调用该函数时,它会向外部 API 发送 GET 以提取一些数据。
现在,当我在本地使用:firebase serve --only functions和ngrok. 这些将允许我在 API.AI 上测试该功能并且它工作正常。
但是当我决定使用: 将firebase deploy --only functions它部署到 firebase 时,它根本不起作用并抛出此错误:
error: { RequestError: Error: getaddrinfo EAI_AGAIN newsapi.org:443
at new RequestError (/user_code/node_modules/request-promise/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/user_code/node_modules/request-promise/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/user_code/node_modules/request-promise/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/user_code/node_modules/request/request.js:188:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (/user_code/node_modules/request/request.js:884:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at TLSSocket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at connectErrorNT (net.js:1020:8) …Run Code Online (Sandbox Code Playgroud) I am trying to use the updateIntent function that is part of the Dialogflow v2 Client library for Node.js . The reason I am trying to use it, is to be able to add training phrases to an intent.
I cannot seem to get passed this one. Here is the code I am using for it!:
My GetIntent Function:
async function getIntent(intentId) {
try {
let responses = await intentsClient.getIntent({name: intentId, intentView: 'INTENT_VIEW_FULL'})
const response = responses[0]
// console.log(response)
return …Run Code Online (Sandbox Code Playgroud)