title: How to correctly call queryStringParameters for AWS Lambda + API Gateway?
body: <p>I'm following a tutorial on setting up AWS API Gateway with a Lambda Function to create a restful API. I have the following code:</p>
  <pre><code>import json
  
  def lambda_handler(event, context):
      # 1. Parse query string parameters
      transactionId = event['queryStringParameters']['transactionid']
      transactionType = event['queryStringParameters']['type']
      transactionAmounts = event['queryStringParameters']['amount']
  
      # 2. Construct the body of the response object
      transactionResponse = {}
      # returning values originally passed in then add separate field at the bottom
      transactionResponse['transactionid'] = transactionId
      transactionResponse['type'] = transactionType
      transactionResponse['amount'] = transactionAmounts
      transactionResponse['message'] = 'hello from lambda land'
  
      # 3. Construct http response object
      responseObject = {}
      responseObject['StatusCode'] = 200
      responseObject['headers'] = {}
      responseObject['headers']['Content-Type'] = 'application/json'
      responseObject['body'] = json.dumps(transactionResponse)
  
      # 4. Return the response object
      return responseObject
  
  </code></pre>
  <p>When I link the API Gateway to this function and try to call it using query parameters I get the error:</p>
  <pre><code>{
  &quot;message&quot;:&quot;Internal server error&quot;
  }
  </code></pre>
  <p>When I test the lambda function it returns the error:</p>
  <pre><code>{
    &quot;errorMessage&quot;: &quot;'transactionid'&quot;,
    &quot;errorType&quot;: &quot;KeyError&quot;,
    &quot;stackTrace&quot;: [
      &quot;  File \&quot;/var/task/lambda_function.py\&quot;, line 5, in lambda_handler\n    transactionId = event['queryStringParameters']['transactionid']\n&quot;
    ]
  </code></pre>
  <p>Does anybody have any idea of what's going on here/how to get it to work?</p>