跳至内容

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

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。