跳至內容

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

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。