title: Unable to fetch TableName Serverless Framework: Missing required key 'TableName' in params
body: <p>I followed this <a href="https://www.youtube.com/watch?v=LXB2Nv9ygQc&amp;t=2520s" rel="nofollow noreferrer">YouTube tutorial</a> first to try and develop a serverless rest api using serverless framework. It gave an error of MissingRequiredParameter and initialised table name to undefined.</p>
  <p>To alleviate that, I found a similar code on <a href="https://github.com/cypherkunp/lambda-kittens-app" rel="nofollow noreferrer">GitHub</a> but deploying this also gives the same error.</p>
  <p>Here are the console logs in cloud watch:</p>
  <pre><code>2021-06-19T23:12:12.606Z    97a3c3b8-375b-4e12-9b89-7ad1e44f1873    INFO    Error saving the kitten to the DB:  MissingRequiredParameter: Missing required key 'TableName' in params
      at ParamValidator.fail (/var/task/node_modules/aws-sdk/lib/param_validator.js:50:37)
      at ParamValidator.validateStructure (/var/task/node_modules/aws-sdk/lib/param_validator.js:61:14)
      at ParamValidator.validateMember (/var/task/node_modules/aws-sdk/lib/param_validator.js:88:21)
      at ParamValidator.validate (/var/task/node_modules/aws-sdk/lib/param_validator.js:34:10)
      at Request.VALIDATE_PARAMETERS (/var/task/node_modules/aws-sdk/lib/event_listeners.js:132:42)
      at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
      at callNextListener (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
      at /var/task/node_modules/aws-sdk/lib/event_listeners.js:86:9
      at finish (/var/task/node_modules/aws-sdk/lib/config.js:386:7)
      at /var/task/node_modules/aws-sdk/lib/config.js:404:9 {
    code: 'MissingRequiredParameter',
    time: 2021-06-19T23:12:12.603Z
  }
  
  
  
  2021-06-19T23:12:12.606Z    97a3c3b8-375b-4e12-9b89-7ad1e44f1873    DEBUG   putParams:  { TableName: undefined, Item: { name: 'Fluffy', age: 4 } }
  
  
  </code></pre>
  <p>It gives an error 502 Bad Gateway</p>
  <p>serverless.yaml file</p>
  <pre><code>service: lambda-kittens-app
  
  provider:
      name: aws
      runtime: nodejs12.x
  
  iamRoleStatements:
      - Effect: 'Allow'
        Action:
            - dynamodb:PutItem
            - dynamodb:Scan*
            - dynamodb:GetItem
            - dynamodb:UpdateItem
            - dynamodb:DeleteItem
        Resource: arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/${self:service}-kittens-${opt:stage}
  
  environment:
      DYNAMODB_KITTEN_TABLE: ${self:service}-kittens-${opt:stage}
  functions:
      create:
          handler: handler.createKitten
          events:
              - http:
                    path: /v1/kitten
                    method: post
      list:
          handler: handler.listKitten
          events:
              - http:
                    path: /v1/kitten
                    method: get
      get:
          handler: handler.getKitten
          events:
              - http:
                    path: /v1/kitten/{name}
                    method: get
      update:
          handler: handler.updateKitten
          events:
              - http:
                    path: /v1/kitten/{name}
                    method: patch
      delete:
          handler: handler.deleteKitten
          events:
              - http:
                    path: /v1/kitten/{name}
                    method: delete
  resources:
      Resources:
          kittensTable:
              Type: 'AWS::DynamoDB::Table'
              Properties:
                  TableName: ${self:service}-kittens-${opt:stage}
                  AttributeDefinitions:
                      - AttributeName: name
                        AttributeType: S
                  KeySchema:
                      - AttributeName: name
                        KeyType: HASH
                  BillingMode: PAY_PER_REQUEST
  Plugins:
      - serverless-pseudo-parameters
  #  Outputs:
  #     NewOutput:
  #       Description: &quot;Description for the output&quot;
  #       Value: &quot;Some output value&quot;
  
  </code></pre>
  <p>Changes made to db-handler.js</p>
  <pre><code>AWS.config.update({ region: 'us-east-1' });
  </code></pre>
  <p>Help is appreciated. Thanks!</p>
  <p>NOTE: I did check several solutions but none of them seems to work.</p>