내용으로 건너뛰기

Lambda function triggered by API Gateway and Lambda tests, but not by POST request to API Gateway domain name.

0

I have a Lambda function that is set up to be triggered via API Gateway. When I test from AWS Lambda, the function executes correctly. When I test from API Gateway, the function executes just fine. However, when I attempt to post to the custom domain name I set up in API Gateway, I get a 500. Additionally, the function does not put any logs to CloudWatch, which leads me to believe it's not being invoked. I have a trigger set up with API Gateway to invoke the function, so I'm not sure why it's not being invoked. API Gateway Trigger API Gateway Test Lambda Test Error Message

1개 답변
0
수락된 답변

Hi,

You have the explanations re. CORS issues (see you error message) and API Gateway in this page: see https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html

If it is a POST method request, it must include an Origin header.

So, you probably need to add this header in your request when you POST to the API Gateway,

This post shows how to configure CORS from console: https://medium.com/geekculture/simple-steps-to-enable-cors-in-api-gateway-through-console-cloud-formation-c09d9df31c07

Best,

Didier

전문가

답변함 2년 전

전문가

검토됨 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠