As AWS Lambda announced their support for Python 3.6 a few days ago, I was testing flask-lambda with Python 3.6.
Under the FlaskLambda.__call__ method, there is this:
body = next(self.wsgi_app(
make_environ(event),
response.start_response
))
However, the type of body always becomes bytes, and you ways end up getting the following error message when calling it via AWS Lambda.
An error occurred during JSON serialization of response: b'(your response)' is not JSON serializable
I know the following patch (body -> body.decode('utf-8')) will get my work done for now, but it is probably not a good general solution.
return {
'statusCode': response.status,
'headers': response.response_headers,
'body': body.decode('utf-8')
}
What would be a good resolution for this issue?
As AWS Lambda announced their support for Python 3.6 a few days ago, I was testing
flask-lambdawith Python 3.6.Under the
FlaskLambda.__call__method, there is this:However, the type of
bodyalways becomesbytes, and you ways end up getting the following error message when calling it via AWS Lambda.I know the following patch (
body->body.decode('utf-8')) will get my work done for now, but it is probably not a good general solution.What would be a good resolution for this issue?