小编Ant*_*llo的帖子

已部署的 Firebase 函数无法对外部 API 执行 HTTP GET?

我正在尝试创建我的第一个 Google Home Action,就像我的 Amazon Alexa 技能一样。这个动作的工作方式是,你执行一个意图,然后在我的代码中调用一个函数。调用该函数时,它会向外部 API 发送 GET 以提取一些数据。

现在,当我在本地使用:firebase serve --only functionsngrok. 这些将允许我在 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)

node.js firebase google-cloud-functions google-home

2
推荐指数
1
解决办法
1431
查看次数

Dialogflow v2 Nodejs Client Library UpdateIntent when adding Training Phrases

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)

google-api node.js dialogflow-es

2
推荐指数
1
解决办法
1439
查看次数