Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

In my project I create a py function for check and modify my google calendar like this:

def main(event, context):

    ck_app = check(event['calID'], event['datada'], event['dataa'])

    if not ck_app: insert(event['calID'], event['datada'], event['dataa'], event['email'])

    return {

        "isBase64Encoded": False,

        "statusCode": '200',

        "headers": {},

        "body": {'input': event,

                 'busy': ck_app,

                 'guest_email': event['email']}   

    }

when I test it on my lambda all done, but when I create an API from lambda:

image

and test it the result is:

Wed Dec 20 13:35:58 UTC 2017: Execution failed due to configuration error: Malformed Lambda proxy response Wed Dec 20 13:35:58 UTC 2017: Method completed with status: 502

1 Answer

0 votes
by (44.4k points)

A JSON body is expected by API Gateway, so do this:

import json

return {

    'statusCode': 200,

    'body': json.dumps({'input': event,

                        'busy': ck_app,

                        'guest_email': event['email']})

}

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories

...