RetrieveAllSubscribersLambdaPermissionApiGateway:
Type: 'AWS::Lambda::Permission'
Properties:
FunctionName: { "Fn::GetAtt": [ RetrieveAllSubscribersLambdaFunction, Arn ] }
Action: lambda:InvokeFunction
Principal: apigateway.amazonaws.com
SourceArn:
!Join
- "/"
- - 'arn:aws:execute-api:us-west-2:12345'
- - 'other stuff'
I have this block of code where I try and get a sourceArn
for this block. I realize the sourceArn is invalid in this example, but so is the viewed output from Serverless.
An error occurred: RetrieveAllSubscribersLambdaPermissionApiGateway - 1 validation error detected: Value 'arn:aws:execute-api:us-west-2:12345/aws/:execute-api:/us-west-2/:/12345/:/a5dghhjk9//*/*' at 'sourceArn' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\d{1})?:(\d{12})?:(.*) (Service: AWSLambda; Status Code: 400; Error Code: ValidationException; Request ID: a8db5326-dcdd-4abc-b4ae-e4fa5c03c6bd; Proxy: null).
-- Update 2022/01/16 12:49 AM The problem was indeed with the tags. Everything can be seen on the issue. TLDR; use the full function name (e.g. 'Fn::Join').
However, I'm almost certain that the shorthand can work, there are just some conditions that need to be met first. I will not investigate, since a working solution for the original problem has been achieved and anything else would be outside the scope.
-- Original
After some back and forth between Ryan and myself. Ryan used an alternative solution involving !Sub
and the serverless-cloudformation-sub-variables
plugin which can be viewed here.
In short, the problem likely laid in dependencies involving tags not correctly being resolved (most likely due to misconfigurations. Still investigating and will update if the original solution can be resolved with additional plugins).
The following plugin abstracts the use of !Sub
which in turn resolved the issue,
serverless-cloudformation-sub-variables