title: Lambda function not running part of code returning nothing
body: <p>I am trying to have a function return the correct values back to another function which does processing on the returned data. I have this function inside the same file as the one I am trying to call it from - a Lambda function - I am calling it using <code>const response = sendRequest(url)</code> which the url is provided from another variable. I've checked this variable and it is for sure the correct value I set it to.</p>
  
  <p>The goal is to return information about the request back to the primary function. I want to process the data there and act on it. </p>
  
  <p>The actual request function should be fine as I can run it exactly as it is - minus the resolve part - in a <code>test.js</code> file. </p>
  
  <p>Problematic function</p>
  
  <pre><code>async function sendRequest (url) {
    let code;
    return new Promise((resolve, reject) =&gt; {
      request({ url, timeout: 20000 }, (error, response, body) =&gt; {
        if (error == 'ENOTFOUND' || error == 'ETIMEDOUT') {
          response.statusCode = 500;
        }
        if (error || (response.statusCode &lt; 200 &amp;&amp; response.statusCode &gt; 299) || !response.statusCode) {
          if (!response || !response.statusCode) {
            code = 500;
          } else {
            code = response.statusCode;
          }
        }
        console.log(`Elapsed time: ${response.elapsedTime}`)
        return resolve({code, error, elapsedTime: response.elapsedTime})
      });
    });
  }
  </code></pre>
  
  <p>Current output</p>
  
  <pre><code>{error: null}
  </code></pre>