Open ceberz opened 1 year ago
Thanks for reporting this issue.
SAM and SAM CLI has some basic intrinsics support and unfortunately it doesn't cover all cases at the moment.
I will be discussing this issue with the team to find a path forward.
Any news about this topic? I have the same exact issue.
Any update on this issue? I'm still seeing it using cdk synth and then using sam local start ...
Description:
Using the intrinsic conditional on the CodeUri property of AWS::Serverless::Function ends in failure both on CloudFormation deployment and when trying to use
sam local start-api
locally.Issue aws/serverless-application-model#22 mentions added support for intrinsic functions on this very field (CodeUri). It does not mention support for
Fn::If
specifically, but even the functions specifically named (such as Fn::Sub) led to the same error on deploy. I'm wondering if there's some caveat that I'm just not getting, or if something else is going on.Further down the thread in issue aws/serverless-application-model#22 @aaronp-hd claims that they've gotten this exact scenario to work, but while I'm pretty sure I'm following their example to the letter I still get the error.
Steps to reproduce:
In a template with a defined condition, use intrinsic
Fn::If
function on theCodeUri
property of a AWS::Serverless::Function resource. Try to build and deploy withsam build
andsam deploy
.Observed result:
On deployment I get this error:
...and when running locally the error is a little different:
The above error is logged right before the process would normally log "[1] Containers Initialization is done." on a healthy run.
Expected result:
Successful deployment and successful start-up of
sam local start-api
.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)