title: Serverless Error TypeError: Cannot read property 'toLowerCase' of undefined
body: <p>I tried to deploy something like <a href="https://www.serverless.com/blog/how-to-create-a-rest-api-in-java-using-dynamodb-and-serverless/" rel="nofollow noreferrer">this example</a> from <a href="https://www.serverless.com/" rel="nofollow noreferrer">serverless</a>. Building my <code>serverless.yml</code>, I run into this error, of which I don't find a handle to deal with:</p>
  <pre class="lang-yaml prettyprint-override"><code>service: products-api
  
  package:
    artifact: target\products-api-dev.jar
    #artifact: target\${self:service}-${self:provider.stage}.jar #cool alternative :)
  
  provider:
    name: aws
    runtime: java8
  
  #Copy-pasted
  resources:
    Resources:
      productsTable:
        Type: AWS::DynamoDB::Table
        Properties:
          TableName: products_table
          AttributeDefinitions:
            - AttributeName: id
              AttributeType: S
            - AttributeName: name
              AttributeType: S
          KeySchema:
            - AttributeName: id
              KeyType: HASH
            - AttributeName: name
              KeyType: RANGE
          ProvisionedThroughput:
            ReadCapacityUnits: 1
            WriteCapacityUnits: 1
  
  functions:
    listProducts:
      handler: com.serverless.ListProductsHandler
      events:
        - http:
            path: /products
            method: get
    getProduct:
      handler: com.serverless.GetProductHandler
      events:
        - http:
            path: /products/{id}
            method: get
    createProduct:
      handler: com.serverless.CreateProductHandler
      events:
        - http:
            path: /products
            method: post
    deleteProduct:
      handler: com.serverless.DeleteProductHandler
      events:
        - http:
            path: /products/{id}
  </code></pre>
  <p>The error I get is this - not having a reference to a mistake in my own code makes difficult to spot where I went wrong.
  I looked into many Q/A including <a href="https://stackoverflow.com/questions/55292269/why-i-got-typeerror-cannot-read-property-tolowercase-of-undefined">this</a> and <a href="https://stackoverflow.com/questions/42542137/typescript-cannot-read-property-tolowercase-of-undefined">this</a>, but it seems to be more of a javascript and typescript problem there, not serverless as here.</p>
  <pre><code> Type Error ----------------------------------------------
  
    TypeError: Cannot read property 'toLowerCase' of undefined
        at AwsCompileApigEvents.getHttpMethod (C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:195:24)
        at C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:50:30
        at Array.forEach (&lt;anonymous&gt;)
        at C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:45:37
        at Array.forEach (&lt;anonymous&gt;)
        at AwsCompileApigEvents.validate (C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:44:55)
        at Object.package:compileEvents [as hook] (C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\index.js:318:31)
        at PluginManager.invoke (C:\snapshot\serverless\lib\classes\PluginManager.js:579:20)
        at async PluginManager.spawn (C:\snapshot\serverless\lib\classes\PluginManager.js:601:5)
        at async Object.before:deploy:deploy [as hook] (C:\snapshot\serverless\lib\plugins\deploy.js:60:11)
        at async PluginManager.invoke (C:\snapshot\serverless\lib\classes\PluginManager.js:579:9)
        at async PluginManager.run (C:\snapshot\serverless\lib\classes\PluginManager.js:639:7)
        at async Serverless.run (C:\snapshot\serverless\lib\Serverless.js:452:5)
        at async C:\snapshot\serverless\scripts\serverless.js:751:9
       For debugging logs, run again after setting the &quot;SLS_DEBUG=*&quot; environment variable.
  </code></pre>