0

I'm developing several AWS serverless applications using Lambda and API gateway.

At one point, I tried to execute an API request on one application (using requests python lib) from code running inside a Lambda function in another application. I get 500 server error. From the logs it appears that the Lambda function behind the API gateway is not starting at all. I don't find any logs that can tell me what happened.

Additional details:

1
  • Go in AWS console section API Gateway, there is option to test your request. By performing the request it will tell you more specifically if you have any permission issues. Commented Jul 30, 2020 at 21:42

2 Answers 2

2

The issue was that the calling lambda needed permission to execute the second lambda behind the API gateway. I don't know why that is. I also still don't know how I should have debugged this - where are the logs that should tell me what was the issue. Eventually it was a lucky guess on my side.

Sign up to request clarification or add additional context in comments.

2 Comments

Please have a look over here github.com/awslabs/serverless-application-model/issues/59 , it could be missing permission.
This also worked for me - adding permissions to execute the Lambda function behind the API. Not sure why this would be necessary, but perhaps it is intended behavior? Couldn't find any documentation on it. Setting InvokeRole: None did not work for me.
1

Possibly not relevant to OP, but this question pointed me in the right direction for a similar issue.

For anyone hitting this error using AWS SAM, adding InvokeRole: NONE to your template prevents you from having to add permissions for every function to your Auth role, e.g.

Auth:
  DefaultAuthorizer: AWS_IAM
  AddDefaultAuthorizerToCorsPreflight: false
  InvokeRole: NONE

See GitHub for further info.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.