Accept Parameters
examples/aws/echo.py
import json def lambda_handler(event, context): name = event['queryStringParameters']['name'] return { 'statusCode': 200, 'headers': { 'Content-Type': 'application/json' }, 'body': json.dumps({ 'message': 'Hello {}!'.format(name) }) }
- Save and Click "Test"
- Observe the error
{ "errorMessage": "'queryStringParameters'", "errorType": "KeyError", "stackTrace": [ [ "/var/task/lambda_function.py", 4, "lambda_handler", "name = event['queryStringParameters']['name']" ] ] }
- Our Python code is not safe enough, we assume a field "name" to be passed in.