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

Deployed Firebase Function Cannot Execute HTTP GET to external API?

我正在尝试创建我的第一个 Google Home Action,它具有与我的 Amazon Alexa Skill 相同的功能。这个动作的工作方式是,你执行一个意图,然后调用我的代码中的一个函数。调用该函数时,它会向外部 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)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
  name: 'RequestError',
  message: 'Error: getaddrinfo EAI_AGAIN newsapi.org:443',
  cause: 
   { Error: getaddrinfo EAI_AGAIN newsapi.org:443
       at Object.exports._errnoException (util.js:1026:11)
       at errnoException (dns.js:33:15)
       at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
     code: 'EAI_AGAIN',
     errno: 'EAI_AGAIN',
     syscall: 'getaddrinfo',
     hostname: 'newsapi.org',
     host: 'newsapi.org',
     port: 443 },
  error: 
   { Error: getaddrinfo EAI_AGAIN newsapi.org:443
       at Object.exports._errnoException (util.js:1026:11)
       at errnoException (dns.js:33:15)
       at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
     code: 'EAI_AGAIN',
     errno: 'EAI_AGAIN',
     syscall: 'getaddrinfo',
     hostname: 'newsapi.org',
     host: 'newsapi.org',
     port: 443 },
  options: 
   { uri: 'https://newsapi.org/v1/articles?source=hacker-news&sortBy=top&apiKey=8b87b4978b22493cadeb351cce01d52a',
     headers: { 'User-Agent': 'Request-Promise' },
     family: 4,
     json: true,
     callback: [Function: RP$callback],
     transform: undefined,
     simple: true,
     resolveWithFullResponse: false,
     transform2xxOnly: false },
  response: undefined }

我似乎找不到任何这不起作用的原因,因为我可以在本地测试它并通过点击请求中使用的相同 URL 来获取数据。在此示例中,我使用 request-promise 来完成请求,但我还使用了库:gotrequesthttps.

我该如何克服这个问题?

我唯一发现的可能是我没有使用付费的 Firebase 计划