title: Serverless Framework / Lambda Errors on External Http Calls
body: <p>I wrote a simple service with Serverless Framework deployed to AWS Lambda that makes a call to an External Http Service and returns the results.</p>
  
  <p>Currently the service works fine locally, but does not work when deployed to AWS.</p>
  
  <p>There seems to be some problem with the async call resolve on response. If I remove the external http call the simple hello function works fine remotely.</p>
  
  <p><strong>Here is some code for review:</strong> </p>
  
  <p><a href="https://github.com/kevbaker/serverless-typescript-call-mock-api" rel="nofollow noreferrer">https://github.com/kevbaker/serverless-typescript-call-mock-api</a></p>
  
  <p><strong>Here is a snippet of the handler:</strong></p>
  
  <pre><code>import { APIGatewayEvent, Callback, Context, Handler } from 'aws-lambda';
  import axios from 'axios';
  
  export const hello: Handler = async (event: APIGatewayEvent, context: Context, cb: Callback) =&gt; {
  
    // External Http call with Axios
    let URL:string = "https://demo8946897.mockable.io";
    let mockResponse = await axios.get(URL,{});
  
    // Send response
    const response = {
      statusCode: 200,
      body: {
        message: 'Go Serverless Webpack (Typescript) v1.0! Your function executed successfully!',
        mockResponse: mockResponse.data
      },
    };
    cb(null, response);
  }
  </code></pre>
  
  <p>Any thoughts? I've done a bunch of poking around for this issue. Change to Fetch-node, reviewed logs no luck yet.</p>