serverless-express icon indicating copy to clipboard operation
serverless-express copied to clipboard

Cannot deploy - constraint failed

Open kjprice opened this issue 9 years ago • 4 comments

I am running npm run setup, it looks like I am getting all the way through until the very end. I am getting an exit status of 255 from npm run deploy. Throwing the --debug flag on top of that aws command provides me with the full stack of the error.

The error is described in the last 30% of the output:

2017-04-19 12:04:47,538 - MainThread - botocore.parsers - DEBUG - Response body:
b'<ErrorResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">\n  <Error>\n    <Type>Sender</Type>\n    <Code>ValidationError</Code>\n    <Message>1 validation error detected: Value \'[CAPABILITY_NAMED_IAM, true[B]\' at \'capabilities\' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [CAPABILITY_NAMED_IAM, CAPABILITY_IAM]]</Message>\n  </Error>\n  <RequestId>4afa421b-2522-11e7-a6cd-c3bbf2db20f6</RequestId>\n</ErrorResponse>\n'
2017-04-19 12:04:47,539 - MainThread - botocore.hooks - DEBUG - Event needs-retry.cloudformation.CreateChangeSet: calling handler <botocore.retryhandler.RetryHandler object at 0x109266be0>
2017-04-19 12:04:47,539 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2017-04-19 12:04:47,539 - MainThread - awscli.customizations.cloudformation.deployer - DEBUG - Unable to create changeset
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/awscli/customizations/cloudformation/deployer.py", line 102, in create_changeset
    Description=description
  File "/usr/local/lib/python3.5/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.5/site-packages/botocore/client.py", line 557, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the CreateChangeSet operation: 1 validation error detected: Value '[CAPABILITY_NAMED_IAM, true[B]' at 'capabilities' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [CAPABILITY_NAMED_IAM, CAPABILITY_IAM]]
2017-04-19 12:04:47,540 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/awscli/clidriver.py", line 199, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/usr/local/lib/python3.5/site-packages/awscli/clidriver.py", line 337, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/usr/local/lib/python3.5/site-packages/awscli/customizations/commands.py", line 187, in __call__
    return self._run_main(parsed_args, parsed_globals)
  File "/usr/local/lib/python3.5/site-packages/awscli/customizations/cloudformation/deploy.py", line 160, in _run_main
    parsed_args.execute_changeset)
  File "/usr/local/lib/python3.5/site-packages/awscli/customizations/cloudformation/deploy.py", line 168, in deploy
    capabilities=capabilities)
  File "/usr/local/lib/python3.5/site-packages/awscli/customizations/cloudformation/deployer.py", line 178, in create_and_wait_for_changeset
    stack_name, cfn_template, parameter_values, capabilities)
  File "/usr/local/lib/python3.5/site-packages/awscli/customizations/cloudformation/deployer.py", line 107, in create_changeset
    raise ex
  File "/usr/local/lib/python3.5/site-packages/awscli/customizations/cloudformation/deployer.py", line 102, in create_changeset
    Description=description
  File "/usr/local/lib/python3.5/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.5/site-packages/botocore/client.py", line 557, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the CreateChangeSet operation: 1 validation error detected: Value '[CAPABILITY_NAMED_IAM, true[B]' at 'capabilities' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [CAPABILITY_NAMED_IAM, CAPABILITY_IAM]]
2017-04-19 12:04:47,540 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

An error occurred (ValidationError) when calling the CreateChangeSet operation: 1 validation error detected: Value '[CAPABILITY_NAMED_IAM, true[B]' at 'capabilities' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [CAPABILITY_NAMED_IAM, CAPABILITY_IAM]]

Important part at the very end:

An error occurred (ValidationError) when calling the CreateChangeSet operation: 1 validation error detected: Value '[CAPABILITY_NAMED_IAM, true[B]' at 'capabilities' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [CAPABILITY_NAMED_IAM, CAPABILITY_IAM]]

I'm certain this is misbehaving from the --capabilities CAPABILITY_IAM option, but I don't understand why or how to fix it. Is this a common issue?

kjprice avatar Apr 19 '17 17:04 kjprice

Would you share what you change on the CloudFormation template or the script?

kahouieong avatar Apr 24 '17 18:04 kahouieong

@kjprice did you resolve? Try updating your aws cli?

brettstack avatar May 05 '17 22:05 brettstack

Got a similar issue using sam cli which is wrapping the aws cli for cloudformation command. A command somewhere in the call stack doesn't use the capability option correctly which is:

Valid Values: CAPABILITY_IAM | CAPABILITY_NAMED_IAM

kalinchernev avatar Mar 18 '18 12:03 kalinchernev

facing similar issue again --

sam deploy --template-file ./cloudformation/packaged.yaml --s3-bucket myfirsts39011096128 --stack-name "zamku-dev-portal" --capabilities CAPABILITY_IAM CognitoDomainNameOrPrefix= "zdd9011096128" DevPortalSiteS3BucketName="zamku-dev-portal-static-assets" ArtifactsS3BucketName="zamku-dev-portal-artifacts"

    Deploying with following values
    ===============================
    Stack name                 : zamku-dev-portal
    Region                     : None
    Confirm changeset          : False
    Deployment s3 bucket       : myfirsts39011096128
    Capabilities               : ["CAPABILITY_IAM", "CognitoDomainNameOrPrefix=", "zdd9011096128", "DevPortalSiteS3BucketName=zamku-dev-portal-static-assets", "ArtifactsS3BucketName=zamku-dev-portal-artifacts"]
    Parameter overrides        : {}

Initiating deployment

Error: Failed to create changeset for the stack: zamku-dev-portal, An error occurred (ValidationError) when calling the CreateChangeSet operation: 1 validation error detected: Value '[CAPABILITY_IAM, CognitoDomainNameOrPrefix=, zdd9011096128, DevPortalSiteS3BucketName=zamku-dev-portal-static-assets, ArtifactsS3BucketName=zamku-dev-portal-artifacts]' at 'capabilities' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy enum value set: [CAPABILITY_AUTO_EXPAND, CAPABILITY_NAMED_IAM, CAPABILITY_IAM]]

rjdugar avatar May 12 '20 13:05 rjdugar