Hello, facing a small problem with the sam deploy command under v0.37.0. Currently returns the following output:
Deploying with following values
===============================
Stack name : test-app
Region : us-east-1
Confirm changeset : False
Deployment s3 bucket : None
Capabilities : null
Parameter overrides : {}
Initiating deployment
=====================
Error: Failed to create changeset for the stack: test-app, Parameter validation failed:
Invalid type for parameter Capabilities, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>
The exact same template deploys fine on v0.33.1. Here's the template:
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
TestApp:
Type: 'AWS::Lambda::Function'
Properties:
Description: 'FIXME test_app Simple Function'
Environment:
Variables:
APP_ENV: 'production'
FunctionName: 'test_app'
Handler: 'app/lambda.execute'
MemorySize: 128
Role: 'arn:aws:iam::***:role/LambdaGeneric'
Runtime: 'python3.7'
Timeout: 60
Could it be that the default value for capabilities was removed?
https://github.com/awslabs/aws-sam-cli/commit/02ea704fa06c938f6598220936df0f7f9951c99a#diff-cee8562a5cceb15939365bf969f8c005L157
I also noticed it sets CAPABILITY_IAM as default in some cases on the deploy command:
https://github.com/awslabs/aws-sam-cli/blob/v0.37.0/samcli/commands/deploy/command.py#L303
Was that a hidden default for the capabilities parameter? If that's the case, I can just feed that as a param in my deploy command and move on, but I'm a bit unsure. Any advice?
It was a hidden default that was removed. Providing would be the best bet or following through on sam deploy --guided which will set it for you.
Ah, ok, great, will set it as explicit param in my process so it keeps the same value. I suppose this can be closed now. Thanks a lot.
Could a better error be provided to the user? Currently if there's not --capabilities passed you end up eventually failing with Invalid type for parameter Capabilities, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'> which doesn't lead the user to know how to correct this.
I will post this here since I ran into this discussion trying to solve for it and so someone may also find this helpful. If you instead run
aws cloudformation deploy --stack-name my-stack-name --template-file my_template.yaml --s3-bucket my_bucket --s3-prefix my_prefix
AWS CLI will actually tell you which capability you need. In my case, I needed both CAPABILITY_AUTO_EXPAND and CAPABILITY_IAM. Then you can go back and package your template with SAM and run the following SAM deploy command
sam deploy --template-file my_teamplate.yaml --s3-bucket my_bucket --stack-name my_stack_name --capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_IAM
Cheers,
Adam
Most helpful comment
Could a better error be provided to the user? Currently if there's not
--capabilitiespassed you end up eventually failing withInvalid type for parameter Capabilities, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>which doesn't lead the user to know how to correct this.