You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a template.yaml specifying AWS::Serverless::LayerVersion, unable to specify a single !Ref ParameterName to CompatibleRuntimes, even if you try to send it as a List (of one item)
(You can also try it without a dash in front of !Ref, or with two dashes, or with no dashes and no "!Ref" token, it still fails)
Observed result
-- Two debug runs here, for three different ways of trying it. First run has two different-syntax attempts:
Layer1:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: layer-1
Description: "Bug Example #1"
ContentUri:
Bucket: !Ref MyLambdaBucketNameParam
Key: 'lambda-zips/layer-aws-wrapper_v2_no_xray.zip'
CompatibleRuntimes:
- !Ref MyLambdaRuntimeParam
2019-02-12 12:55:33 deploy command is called
Uploading to 84451a0ac75787cc911fcc8331083ae3.template 3288 / 3288.0 (100.00%)
Waiting for changeset to be created..
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 2. Resource with id [Layer1] is invalid. Type of property 'CompatibleRuntimes' is invalid. Resource with id [Layer2] is invalid. Type of property 'CompatibleRuntimes' is invalid.
2019-02-12 12:55:39 Exception: Command '['aws', 'cloudformation', 'deploy', '--capabilities', 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND', '--region', 'us-east-2', '--s3-bucket', 'sdp-yourpitchcount-repl-east2', '--parameter-overrides', 'MyAppPrefixParam=pitchaur', 'MyLambdaBucketNameParam=sdp-yourpitchcount-repl-east2', '--tags', 'deployed-via=p-sdepl-layers.sh', '--stack-name', 'sdp-yourpitchcount-layers', '--template-file', 'packaged-layers.yaml']' returned non-zero exit status 255.
Trying it a third way, we get a little further but still the Stack rolls back:
Throws a Create_Failed event with Status Reason:
Property validation failure: [Value of property {/CompatibleRuntimes} does not match type {Array}]
And the Stack rolls back
Expected result
Expected result was that at least one of these should have worked, and created the LayerVersion (thought that the example "Layer1" above would work)
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
OS: Ubuntu 18
sam --version:
SAM CLI, version 0.11.0
The text was updated successfully, but these errors were encountered:
Description
In a template.yaml specifying AWS::Serverless::LayerVersion, unable to specify a single !Ref ParameterName to CompatibleRuntimes, even if you try to send it as a List (of one item)
template.yaml snippet
Parameters:
MyLambdaRuntimeParam:
Type: String
Default: 'nodejs8.10'
Layer1:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: layer-1
ContentUri:
Bucket: ...
Key: ...
CompatibleRuntimes:
- !Ref MyLambdaRuntimeParam
(You can also try it without a dash in front of !Ref, or with two dashes, or with no dashes and no "!Ref" token, it still fails)
Observed result
-- Two debug runs here, for three different ways of trying it. First run has two different-syntax attempts:
Layer1:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: layer-1
Description: "Bug Example #1"
ContentUri:
Bucket: !Ref MyLambdaBucketNameParam
Key: 'lambda-zips/layer-aws-wrapper_v2_no_xray.zip'
CompatibleRuntimes:
- !Ref MyLambdaRuntimeParam
Layer2:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: layer-2
Description: "Bug Example #2"
ContentUri:
Bucket: !Ref MyLambdaBucketNameParam
Key: 'lambda-zips/layer-aws-wrapper_v2_no_xray.zip'
CompatibleRuntimes:
- - !Ref MyLambdaRuntimeParam
And --debug output when running sam deploy was:
2019-02-12 12:55:33 deploy command is called
Uploading to 84451a0ac75787cc911fcc8331083ae3.template 3288 / 3288.0 (100.00%)
Waiting for changeset to be created..
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 2. Resource with id [Layer1] is invalid. Type of property 'CompatibleRuntimes' is invalid. Resource with id [Layer2] is invalid. Type of property 'CompatibleRuntimes' is invalid.
2019-02-12 12:55:39 Exception: Command '['aws', 'cloudformation', 'deploy', '--capabilities', 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND', '--region', 'us-east-2', '--s3-bucket', 'sdp-yourpitchcount-repl-east2', '--parameter-overrides', 'MyAppPrefixParam=pitchaur', 'MyLambdaBucketNameParam=sdp-yourpitchcount-repl-east2', '--tags', 'deployed-via=p-sdepl-layers.sh', '--stack-name', 'sdp-yourpitchcount-layers', '--template-file', 'packaged-layers.yaml']' returned non-zero exit status 255.
Trying it a third way, we get a little further but still the Stack rolls back:
Layer3:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: layer-3
Description: "Bug Example #3"
ContentUri:
Bucket: !Ref MyLambdaBucketNameParam
Key: 'lambda-zips/layer-aws-wrapper_v2_no_xray.zip'
CompatibleRuntimes:
!Ref MyLambdaRuntimeParam
Throws a Create_Failed event with Status Reason:
Property validation failure: [Value of property {/CompatibleRuntimes} does not match type {Array}]
And the Stack rolls back
Expected result
Expected result was that at least one of these should have worked, and created the LayerVersion (thought that the example "Layer1" above would work)
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:SAM CLI, version 0.11.0
The text was updated successfully, but these errors were encountered: