title: Error when trying access parameters in AWS Python Lambda function using API Gateway
body: <p>I have this python lambda function</p>
  
  <pre><code>import json
  
  def lambda_handler(event, context):
  
      post_user = ""
      post_user = event["user"]
      print(post_user)        
  
      return {
          "statusCode": 200,
          "headers": {"Content-Type": "application/json"},
          "body": True
          }
  </code></pre>
  
  <p>This works as expected when I run a test within the lambda IDE. The test is configured to pass:</p>
  
  <blockquote>
    <p>{   "user": "JOHN",   "pwd": "pwd1" }</p>
  </blockquote>
  
  <p>but when I run a test using the API Gateway, I get this error:</p>
  
  <blockquote>
    <p>Mon Mar 25 20:47:29 UTC 2019 : Endpoint response body before
    transformations: {"errorMessage": "'user'", "errorType": "KeyError",
    "stackTrace": ["  File \"/var/task/lambda_function.py\", line 6, in
    lambda_handler\n    post_user = event[\"user\"]\n"]} Mon Mar 25
    20:47:29 UTC 2019 : Lambda execution failed with status 200 due to
    customer function error: 'user'. Lambda request id:
    f7955f74-e608-4b10-b216-4e4acf682307 Mon Mar 25 20:47:29 UTC 2019 :
    Method completed with status: 502</p>
  </blockquote>
  
  <p>I have defined the API gateway test as follows:
  <a href="https://i.stack.imgur.com/oXGqe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oXGqe.png" alt="enter image description here"></a></p>