The error can be caused by incorrect quotation marks.
A. Examples that produce the same error in Postman tests:
1. def lambda_handler(event, context):
return {
'statusCode': 200,
"body": {"one": 1000}
}
2. def lambda_handler(event, context):
return {
'statusCode': 200,
"body": "{"one": 1000}"
}
B. Examples that do not produce the error:
3. def lambda_handler(event, context):
return {
'statusCode': 200,
"body": "{'one': 1000}"
}
4. def lambda_handler(event, context):
return {
'statusCode': 200,
"body": '{"one": 1000}'
}
So, the type of quotation marks used after "body": is the reason for the error in this case. Note that while the Amazon lambda console does not produce an error for example 1., Postman says { "message": "Internal server error" }