title: Deployed Firebase Function Cannot Execute HTTP GET to external API?
body: <p>I am attempting to create my first Google Home Action as with the same functinality of my Amazon Alexa Skill.  The way this action works is, you execute an intent, and that calls a function in my code.  When the function is called, it sends off a GET to an external API to pull some data.  </p>
  
  <p>Now when I run this locally using: <code>firebase serve --only functions</code> and <code>ngrok</code>.  These will allow me to test the function on API.AI and it works fine.</p>
  
  <p>But when I decide to deploy this to firebase using: <code>firebase deploy --only functions</code>, it simply does not work and throws this error:</p>
  
  <pre><code>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&amp;sortBy=top&amp;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 }
  </code></pre>
  
  <p>I cannot seem to find any reason why this would not work, as I can test it locally and get the data by hitting the same URL that is used in the request.  In this example, I am using <code>request-promise</code> to complete the request, but I have also used the libraries: <code>got</code>, <code>request</code>, and <code>https</code>.</p>
  
  <p>How can I overcome this problem?</p>