When attempting to invoke a lambda via API-Gateway, I receive the following 502 error.
Endpoint response body before transformations: <AccessDeniedException>
<Message>Unable to determine service/operation name to be authorized</Message>
</AccessDeniedException>
This appears to only happen on endpoints that utilize Authorizers.
Current versions:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
I followed the steps discussed by @lusentis and @jfuss here: [https://github.com/awslabs/serverless-application-model/issues/59] but I didn't see any change as a result.
I also (unsuccessfully) attempted to manually add/remove permissions in the policy to track down the exact syntax that would work. As long an apigateway invoke permission exists, I get the 502, if no permissions exist I receive a 500 as expected.
The HTTP method doesn't seem to affect the result.
I would be happy to include an example of my setup if that would help.
Looks like the issue was with out API Swagger yml file. As indicated in the docs, x-amazon-apigateway-integration MUST be a POST for lamba integrations.
Thanks for pointing in the right direction. I was using the C# AWS SDK, making a 'PutIntegrationRequest'. I falsely set the 'IntegrationHttpMethod' to the same http method that I wanted to create on a resource, e.g. GET and I got the above error. Changing this to always be 'POST' did the trick :-)
Looks like the issue was with out API Swagger yml file. As indicated in the docs, x-amazon-apigateway-integration MUST be a POST for lamba integrations.
I can confirm this. I had a similar problem but using Terraform.
Thanks a lot!
yes you must use post with integration thanks @NurSpass
ex:
resource "aws_api_gateway_integration" "this" {
rest_api_id = aws_api_gateway_rest_api.api-gateway.id
resource_id = aws_api_gateway_resource.this.id
http_method = aws_api_gateway_method.this.http_method
integration_http_method = "POST"
type = "AWS_PROXY"
uri = module.lambda.invoke_arn
}
Most helpful comment
Looks like the issue was with out API Swagger yml file. As indicated in the docs, x-amazon-apigateway-integration MUST be a POST for lamba integrations.