Error KeyError 'headers' in serverless_wsgi

Hi,
Serverless newbie here. I’m stuck getting the following error thrown when I do a test “POST” call to a Flask route directly in the Lambda (AWS UI):

{
“errorMessage”: “‘headers’”,
“errorType”: “KeyError”,
“stackTrace”: [
" File “/var/task/serverless_sdk/init.py”, line 134, in wrapped_handler\n return user_handler(event, context)\n",
" File “/var/task/wsgi_handler.py”, line 110, in handler\n return serverless_wsgi.handle_request(wsgi_app, event, context)\n",
" File “/var/task/serverless_wsgi.py”, line 94, in handle_request\n headers = Headers(event[u\“headers\”])\n"
]
}

The root Flask route “/” responds as expected, returning a simple message.

Everything works perfectly when I run locally using ‘serverless wsgi serve’.

I’m considering that Flask requires certain headers ( - which it is not being passed when I do this test, but when I try to test with through the API Gateway or externally from Postman I get a “502 Bad Gateway” and “message”: “Internal server error” response.

Same error here, even using sls invoke local