1回答
- 新しい順
- 投票が多い順
- コメントが多い順
0
Hello.
"'Payload'" included in the response is called "StreamingBody", so you need to use "read()" to check the contents.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda/client/invoke.html
"StreamingBody" is described in the following document.
https://botocore.amazonaws.com/v1/documentation/api/latest/reference/response.html
For example, if you check the response without using "read()", it will look like the following.
import boto3
client = boto3.client('lambda')
response = client.invoke(
FunctionName='kobayashi-test')
print(response["Payload"])
<botocore.response.StreamingBody object at 0x7f0ce6004dc0>
You can check the return of the Lambda you called by using "read()".
import boto3
client = boto3.client('lambda')
response = client.invoke(
FunctionName='kobayashi-test')
print(response["Payload"].read())
b'{"statusCode": 200, "body": "\\"Hello from Lambda!\\""}'