Reputation: 133
I am trying to invoke lambda service. When I hit the Get method(under Api gateway->stages->GET) invoke Url I see json headers and status code also. But in the acloud guru lecture video, I see just the body. Can anyone please tell what am I missing here.
Here is my python function:
def lambda_handler(event, context):
print("In lambda handler")
resp = {
"statusCode": 200,
"headers": {
"Access-Control-Allow-Origin": "*",
},
"body": "myName"
}
return resp
Actual Output:
{"statusCode": 200, "headers": {"Access-Control-Allow-Origin": "*"}, "body": "myName"}
Expected output:
myName
Upvotes: 1
Views: 2617
Reputation: 691
here you have used lambda proxy integration and did not enable it in API gateway level.
You can enable it under Integration request, see the image below
There are 2 types of API Gateway and Lambda integration
This blog post gives more details about the 2 integrations https://medium.com/@lakshmanLD/lambda-proxy-vs-lambda-integration-in-aws-api-gateway-3a9397af0e6d
Upvotes: 1