Am trying to deploy a API Gateway REST API which uses a custom authorizer using terraform.
The custom authorizer uses an existing lambda function.
resource "aws_api_gateway_authorizer" "accountprofileauth" {
name = "auth"
rest_api_id = "${aws_api_gateway_rest_api.accountprofileapi.id}"
authorizer_uri = "arn:aws:lambda:us-east-2:XXXX:function:dev-authorizer"
identity_source = "method.request.header.Authorization"
type = "REQUEST"
}
When i did terraform apply, i got the below error
* aws_api_gateway_authorizer.accountprofileauth: Error creating API Gateway Authorizer: BadRequestException: Invalid Authorizer URI: arn:aws:lambda:us-east-2:XXXX:function:dev-authorizer. Authorizer URI should be a valid API Gateway ARN that represents a Lambda function invocation.
status code: 400, request id: XXXX
The lambda function exists and it works fine. The same arn works fine when i deploy using serverless.
Do you know the format/provide an example of valid arn?
Thanks.
There are two types of Lambda authorizers: A token-based Lambda authorizer (also called a TOKEN authorizer) receives the caller's identity in a bearer token, such as a JSON Web Token (JWT) or an OAuth token.
I found the actual format to be
arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:XXXX:function:dev-authorizer/invocations
Looks like the date is kinda hard coded. I was confused by that :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With