I have a very simple problem: my lamda function works fine as long as i do not write something like "a = event["key"], but a = "test":
This is from Cloudwatch:
@message
[ERROR] KeyError: 'key1' Traceback (most recent call last):
@message
[ERROR] KeyError: 'key1' Traceback (most recent call last): File "/var/task/lambda_function.py", line 5, in lambda_handler a = event["key1]
This is what i have sent with postman (i even tried curl) in the body as raw data:
{
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
My lamda function looks like this:
import json
def lambda_handler(event, context):
# TODO implement
a = event["key1"]
return {
'statusCode': 200,
'body': json.dumps(a)
}