Async Python Handlers in AWS Lambda


I am creating my first AWS Lambda function in Python from scratch. My function contains async functions, so I declared my handler with the async keyword. But when I deployed and smoke tested in AWS, I received the following error:

"errorMessage": "Unable to marshal response: Object of type coroutine is not JSON serializable",
"errorType": "Runtime.MarshalError"

Search terms

aws lambda python async handler

Helpful link


Apparently AWS Lambda does not support async handler functions in Python. So you are required to call your asynchronous code from a synchronous handler function using this line of code:


By Paul Shippy

Christian software engineer and homeschooling dad