how to get return response from AWS Lambda function

后端 未结 2 1019
陌清茗
陌清茗 2020-12-13 00:16

I have a simple lambda function that returns a dict response and another lambda function invokes that function and prints the response.

lambda function A

2条回答
  •  青春惊慌失措
    2020-12-13 01:10

    A 202 response means Accepted. It is a successful response but is telling you that the action you have requested has been initiated but has not yet completed. The reason you are getting a 202 is because you invoked the Lambda function asynchronously. Your InvocationType parameter is set to Event. If you want to make a synchronous call, change this to RequestResponse.

    Once you do that, you can get the returned data like this:

    data = invoke_response['Payload'].read()
    

提交回复
热议问题