スキップしてコンテンツを表示

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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ