title: serverless on aws lambda got 502 error of Internal server error
body: <p>I try to use serverless with aws lambda service.</p>
  
  <p>my serverless.yml is:</p>
  
  <pre><code>service: webpack-4-example
  
  # Add the serverless-webpack plugin
  plugins:
    - serverless-webpack
    - serverless-offline
  
  provider:
    name: aws
    runtime: nodejs8.10
    region: us-west-2
    stage: dev
  
  package:
    individually: true
  
  functions:
    first:
      handler: handlers/first.hello
      events:
        - http:
            method: get
            path: /first
    second:
      handler: handlers/second.hello
      events:
        - http:
            method: get
            path: /second
  
  custom:
    webpack:
      webpackConfig: 'webpack.config.js'
      includModules: true
      packager: 'npm'
  </code></pre>
  
  <p>I use serverless-webpack and serverless-offline plugins.</p>
  
  <p>I just write simple serverless for first.js</p>
  
  <pre><code>export const hello = async (event, context) =&gt; {
  const rep = {
  statusCode: 200,
  body: JSON.stringify({
    message: 'v1.0',
    input: event,
  })
  };
  return rep;
  };
  </code></pre>
  
  <p>it can run correctly in localmachine by command line:</p>
  
  <pre><code>sls offline start
  </code></pre>
  
  <p>and give me correct json response.</p>
  
  <p>but it give me error when I try to deploy on aws cloud:</p>
  
  <p>it give me 502 gateway error, with response body:</p>
  
  <pre><code>{"message": "Internal server error"}
  </code></pre>
  
  <p>How to debug on aws serverless cloud and how to fix this error.</p>