Hi, i have a problem with an apigateway with apike...
# general
c
Hi, i have a problem with an apigateway with apikey and lambda setup. My code is here : https://gist.github.com/cosminilie/5d9d1c7ac800ec995423357fba556862. The problem is when i hit the URL with : curl -H "x-api-key:xxxxx" -H "Content-Type: application/json" https://xxxaas.execute-api.eu-west-1.amazonaws.com/prod/bambam i get internal server error. If go to the UI and lick on the lambda function in the Integration Request, i'm prompted with the "You are about to give API Gateway permission to invoke your Lambda function:" hit ok and then it works. I know i'm missing something but i don't know what. Can you guys help out?
Just in case anybody is wandering what was needed was to add as the message said the lambda permissions using something like:
Copy code
// Give permissions from API Gateway to invoke the Lambda
let invokePermission = new aws.lambda.Permission("api-lambda-permission", {
    action: "lambda:invokeFunction",
    function: lambda,
    principal: "<http://apigateway.amazonaws.com|apigateway.amazonaws.com>",
    sourceArn: deployment.executionArn.apply(arn => arn + "*/*"),
});