title: Azure function app ETIMEDOUT error works sometimes but not others
body: <p>I have the below code:</p>
  
  <pre><code>var request = require('request');
  var rp = require('request-promise');
  module.exports = async function(context, req) {
      var arr = [[url1],[url2]]
      for (i = 0; i &lt; arr.length; i++) {
          func(context, arr[i]);
      }
  }
  function func(context, urls) {
      const promises = urls.map(item =&gt; {
          return rp({
              uri: item,
              simple: false,
              resolveWithFullResponse: true
          }).then(response =&gt; {
              if (response.statusCode == 403) {
  
                  var msg = "hello";
                  return msg;
              } else {
                  return null;
              }
          });
      });
  
      return Promise.all(promises).then(data =&gt; {
          // remove null results from array
          return data.filter(item =&gt; item !== null);
      });
  }
  </code></pre>
  
  <p>And I keep getting this error. Sometimes it works, sometimes it doesn't. How can I fix this, and why does it work sometimes and sometimes not.</p>
  
  <pre><code>Result: Failure
  Exception: RequestError: Error: connect ETIMEDOUT 
  </code></pre>
  
  <p>Do I need to inclue a <code>pool</code> option? Or perhaps a <code>timeout</code>? The error seems to be due to the size of <code>arr</code>.</p>