aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.53k stars 1.17k forks source link

sam deploy raises "Unknown parameter in input: "DisableRollback", must be one of: ChangeSetName, StackName, ClientRequestToken" #6197

Open alanmpitts opened 1 year ago

alanmpitts commented 1 year ago

Working with the sample app created with AWS Toolkit v1.97.0 for VS-Code.

From the command line sam build complete successfully. "sam deploy --guided" taking the defaults, and accept the changeset. I get the same result if I install aws-sam-cli using brew, installer package, or using pip install. There was a similar issue logged long ago that had to do with boto3 compatibility. I did upgrade boto3 to latest.

Deploy this changeset? [y/N]: y
Error: Parameter validation failed:
Unknown parameter in input: "DisableRollback", must be one of: ChangeSetName, StackName, ClientRequestToken
❯ sam --info
{
  "version": "1.100.0",
  "system": {
    "python": "3.11.2",
    "os": "macOS-13.6-arm64-arm-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "master",
    "aws_cdk": "2.104.0 (build 3b99abe)",
    "terraform": "1.4.6"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
❯ python --version
Python 3.11.2
❯ pip show boto3
Name: boto3
Version: 1.28.77
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /Users/ME/.pyenv/versions/3.11.2/envs/local311/lib/python3.11/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: aws-sam-cli, aws-sam-translator
❯ pip show botocore
Name: botocore
Version: 1.31.77
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /Users/ME/.pyenv/versions/3.11.2/envs/local311/lib/python3.11/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: boto3, s3transfer
moelasmar commented 1 year ago

thanks @alanmpitts could you please give us the full steps to reproduce the issue, and also rerun the deploy command with --debug flag and share the logs with us so we can investiagate this issue.

alanmpitts commented 1 year ago

I created the project using the VS-Code AWS Toolkit v1.97

VS-Code version

Version: 1.84.0 (Universal)
Commit: d037ac076cee195194f93ce6fe2bdfe2969cc82d
Date: 2023-11-01T11:30:19.406Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0

I right click on Lambda in the AWS Explorer pane. image

For the project prompts:

  1. select python3.11
  2. AWS SAM Hello World
  3. select the target folder
  4. provide a project name

Open the integrated terminal and cd into the created folder in this case "lambda/ec2-inventory".

Then execute the commands in this order.

  1. sam build
  2. sam validate
  3. sam package --template-file template.yaml --output-template-file packaged.yaml
  4. sam deploy --template-file ./packaged.yaml

Deploy this changeset? [y/N]: y Error: Parameter validation failed: Unknown parameter in input: "DisableRollback", must be one of: ChangeSetName, StackName, ClientRequestToken

Here is the deploy with debug as requested

❯ sam deploy --template-file ./packaged.yaml --stack-name ec2-inventory --debug
2023-11-05 20:00:01,479 | Config file location: /Users/ME/projects/AWS/lambda/ec2-inventory/samconfig.toml                                   
2023-11-05 20:00:01,481 | Loading configuration values from [default.['deploy'].parameters] (env.command_name.section) in config file at           
'/Users/ME/projects/AWS/lambda/ec2-inventory/samconfig.toml'...                                                                              
2023-11-05 20:00:01,482 | Configuration values successfully loaded.                                                                                
2023-11-05 20:00:01,482 | Configuration values are: {'stack_name': 'ec2-inventory', 'capabilities': 'CAPABILITY_IAM', 'confirm_changeset': True,   
'resolve_s3': True, 's3_prefix': 'ec2-inventory', 'region': 'us-east-1', 'image_repositories': []}                                                 
2023-11-05 20:00:01,504 | Using config file: samconfig.toml, config environment: default                                                           
2023-11-05 20:00:01,504 | Expand command line arguments to:                                                                                        
2023-11-05 20:00:01,504 | --template_file=/Users/ME/projects/AWS/lambda/ec2-inventory/packaged.yaml --stack_name=ec2-inventory               
--fail_on_empty_changeset --confirm_changeset --on_failure=ROLLBACK --s3_prefix=ec2-inventory --resolve_s3 --capabilities=['CAPABILITY_IAM']       

                Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-1l5ncf4r5xq
                A different default S3 bucket can be set in samconfig.toml
                Or by specifying --s3-bucket explicitly.
2023-11-05 20:00:02,435 | No Parameters detected in the template                                                                                   
2023-11-05 20:00:02,453 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is          
HelloWorldFunction                                                                                                                                 
2023-11-05 20:00:02,454 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical  
id as the resource id                                                                                                                              
2023-11-05 20:00:02,455 | 0 stacks found in the template                                                                                           
2023-11-05 20:00:02,456 | No Parameters detected in the template                                                                                   
2023-11-05 20:00:02,466 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is          
HelloWorldFunction                                                                                                                                 
2023-11-05 20:00:02,467 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical  
id as the resource id                                                                                                                              
2023-11-05 20:00:02,489 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is          
HelloWorldFunction                                                                                                                                 
2023-11-05 20:00:02,490 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is          
HelloWorldFunction                                                                                                                                 
2023-11-05 20:00:02,490 | Property CodeUri of HelloWorldFunction is already a S3 URL                                                               

        Deploying with following values
        ===============================
        Stack name                   : ec2-inventory
        Region                       : us-east-1
        Confirm changeset            : True
        Disable rollback             : False
        Deployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-999999999
        Capabilities                 : ["CAPABILITY_IAM"]
        Parameter overrides          : {}
        Signing Profiles             : {}

Initiating deployment
=====================

2023-11-05 20:00:02,499 | No Parameters detected in the template                                                                                   
2023-11-05 20:00:02,506 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is          
HelloWorldFunction                                                                                                                                 
2023-11-05 20:00:02,507 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical  
id as the resource id                                                                                                                              
2023-11-05 20:00:02,508 | 0 stacks found in the template                                                                                           
2023-11-05 20:00:02,508 | No Parameters detected in the template                                                                                   
2023-11-05 20:00:02,514 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is          
HelloWorldFunction                                                                                                                                 
2023-11-05 20:00:02,515 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical  
id as the resource id                                                                                                                              
2023-11-05 20:00:02,515 | 2 resources found in the stack                                                                                           
2023-11-05 20:00:03,064 | File with same data already exists at ec2-inventory/99999999059.template, skipping upload           

Waiting for changeset to be created..

CloudFormation stack changeset
---------------------------------------------------------------------------------------------------------------------------------------------
Operation                           LogicalResourceId                   ResourceType                        Replacement                       
---------------------------------------------------------------------------------------------------------------------------------------------
+ Add                               HelloWorldFunctionHelloWorldPermi   AWS::Lambda::Permission             N/A                               
                                    ssionProd                                                                                                 
+ Add                               HelloWorldFunctionRole              AWS::IAM::Role                      N/A                               
+ Add                               HelloWorldFunction                  AWS::Lambda::Function               N/A                               
+ Add                               ServerlessRestApiDeployment47fc2d   AWS::ApiGateway::Deployment         N/A                               
                                    5f9d                                                                                                      
+ Add                               ServerlessRestApiProdStage          AWS::ApiGateway::Stage              N/A                               
+ Add                               ServerlessRestApi                   AWS::ApiGateway::RestApi            N/A                               
---------------------------------------------------------------------------------------------------------------------------------------------

Changeset created successfully. arn:aws:cloudformation:us-east-1:999999999999:changeSet/samcli-deploy6969696969696969fd16c6d8-fcc9-403e-8bc1-deadbeef

Previewing CloudFormation changeset before deployment
======================================================
Deploy this changeset? [y/N]: y
2023-11-05 20:00:17,937 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics               
2023-11-05 20:00:18,009 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics               
2023-11-05 20:00:18,010 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': 'd2991c2e-2034-4e5b-b00d-d21e8e9b48bc', 'installationId':   
'a4c0cf0f-d51d-4e20-9d1c-ebc95197f2e3', 'sessionId': 'c0b93c8a-01b8-4845-a299-f37d85d891e7', 'executionEnvironment': 'CLI', 'ci': False,           
'pyversion': '3.11.2', 'samcliVersion': '1.100.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': 'us-east-1', 'commandName':   
'sam deploy', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName':                                                 
'2e5baa0c3a7f9bdb87e43d0480491a7e7246e7d3a6d544bd37ae5391285b293a', 'initialCommit': None}, 'duration': 16433, 'exitReason': 'SDKError',           
'exitCode': 1}}]}                                                                                                                                  
2023-11-05 20:00:18,010 | Unable to find Click Context for getting session_id.                                                                     
2023-11-05 20:00:18,013 | Sending Telemetry: {'metrics': [{'events': {'requestId': '0a1a3bd4-c2e6-42db-bbe6-ddcd90eb74e6', 'installationId':       
'a4c0cf0f-d51d-4e20-9d1c-ebc95197f2e3', 'sessionId': 'c0b93c8a-01b8-4845-a299-f37d85d891e7', 'executionEnvironment': 'CLI', 'ci': False,           
'pyversion': '3.11.2', 'samcliVersion': '1.100.0', 'commandName': 'sam deploy', 'metricSpecificAttributes': {'events': [{'event_name':             
'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '143853afb254426fab91c9467eb2832a', 'time_stamp': '2023-11-06 01:00:01.479',        
'exception_name': None}, {'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '6e23b1e2301e4502ae3219c27b328c06',         
'time_stamp': '2023-11-06 01:00:01.502', 'exception_name': None}]}}}]}                                                                             
2023-11-05 20:00:18,856 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read      
timeout=0.1)                                                                                                                                       
2023-11-05 20:00:18,857 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read      
timeout=0.1)                                                                                                                                       
Error: Parameter validation failed:
Unknown parameter in input: "DisableRollback", must be one of: ChangeSetName, StackName, ClientRequestToken
hawflau commented 1 year ago

Hi @alanmpitts it seems the error is from the execute_change_set call by boto3. But from the boto3 version you provided is quite new. It seems somehow SAM CLI invoked a very old version of boto3 (as support for DisableRollback has been here for 2 years or so). How did you install SAM CLI? and what does which sam show?