title: Avoid ESOCKETTIMEDOUT from Google/Firebase Cloud Functions
body: <p>I have a Firebase cloud function, that is looping through users in a database and sends an email to each one. It uses the Campaign Monitor API for Transactional/Smart Emails, but the request results in an ESOCKETTIMEDOUT error. Campaign Monitor receives and processes each request just fine, but I would like to avoid the error of course.</p>
  
  <p>How can I do this? I've read elsewhere about a setting, 'agent: false, pool: {maxSockets: 100}', but I am not sure if this is the right approach - and I don't know where to set it on a Firebase og Google Cloud Function.</p>
  
  <p>This is the request snippet, that is called by the loop.  </p>
  
  <pre><code>  api.transactional.sendSmartEmail(details, function (err, res) {
      if (err) {
          console.log('error sending mail, err);
          /*Throws:
          { Error: ESOCKETTIMEDOUT
          at ClientRequest.&lt;anonymous&gt; (/user_code/node_modules/createsend-node/node_modules/request/request.js:813:19)
          at ClientRequest.g (events.js:292:16)
          at emitNone (events.js:86:13)
          at ClientRequest.emit (events.js:185:7)
          at TLSSocket.emitTimeout (_http_client.js:630:10)
          at TLSSocket.g (events.js:292:16)
          at emitNone (events.js:86:13)
          at TLSSocket.emit (events.js:185:7)
          at TLSSocket.Socket._onTimeout (net.js:338:8)
          at ontimeout (timers.js:386:11) code: 'ESOCKETTIMEDOUT', connect: false }
          */
      } else {
              console.log('sent mail');
      }
  });
  </code></pre>