Skip to content

Issues with Python 3.6 #1

@suminb

Description

@suminb

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions