Closed revolutionisme closed 3 years ago
In the error message from cloudformation which you posted above, this part is incorrectly duplicated arn:aws:lambda:eu-central-1:023966115288:function
.
I think instead of
uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${LambdaFunction.Arn}/invocations"
you need
uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
because ${LambdaFunction.Arn}
should expand to arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:FUNCTIONNAME
.
Closing as the comment above. Let me know if there are other issues.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Description: I have an api defined in swagger like the following in my appspec.yml file:
Whenever I start start sam cli, i see messages like follows:
Now to fix the issue, I tried the following after seeing some example some where. I basically changed added ".Arn" after function name in my uri of the swagger definition.
uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${LambdaFunction.Arn}/invocations"
The thing is, that this resolved the issue with sam cli (even sam validate validated the template). And I got the following logs:
But when I used the same template to upload to cloudformation and run, it threw me the following error.
which is obvious as it resolved the function arn completely on top of the manually generated arn.
So the issue is why didn't it throw the same error with sam cli?
Steps to reproduce the issue:
uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${LambdaFunction.Arn}/invocations"
Observed result: Runs succesfully in Sam cli, Fails with cloud formation
Expected result: Fail in both the situation or pass in both the situation
Additional environment details (Ex: Windows, Mac, Amazon Linux etc) Mac
Output of
sam --version
: SAM CLI, version 0.6.0