Monday 5 June 2017

CloudFormation aws-sdk for node createStack error UnexpectedParameter: Unexpected key 'ClientRequestToken'

Using a lambda function with runtime Node.js 6.10
I am trying to include a client supplied token (string) as the ClientRequestToken in call to createStack.
If I include ClientRequestToken in the params passed to the createStack function, I get the below error:

2017-06-02T02:08:23.864Z    5a26eb46-4738-11e7-8020-730416363290    { UnexpectedParameter: Unexpected key 'ClientRequestToken' found in params
    at ParamValidator.fail (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:50:37)
    at ParamValidator.validateStructure (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:77:14)
    at ParamValidator.validateMember (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:88:21)
    at ParamValidator.validate (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:34:10)
    at Request.VALIDATE_PARAMETERS (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:108:42)
    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at callNextListener (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
    at /var/runtime/node_modules/aws-sdk/lib/event_listeners.js:74:9
    at finish (/var/runtime/node_modules/aws-sdk/lib/config.js:313:7)
    at /var/runtime/node_modules/aws-sdk/lib/config.js:331:9
  message: 'Unexpected key \'ClientRequestToken\' found in params',
  code: 'UnexpectedParameter',
  time: 2017-06-02T02:08:23.864Z } 'UnexpectedParameter: Unexpected key \'ClientRequestToken\' found in params
    at ParamValidator.fail (/var/runtime/node_modules/aws-sdk/lib/param_validator.js:50:37)

Here is how I am creating the params object:

var params = {
        StackName: stack_name,
        ClientRequestToken : clientRequestToken,
        Capabilities: [
            'CAPABILITY_IAM'
        ],
        NotificationARNs: [
            'arn:aws:sns:ap-southeast-2:account-id:topic-name'
        ],
        Parameters: parameters,
        Tags: [
            {
                 Key: 'Name',
                Value: 'kktest'
            },
        ],
        TemplateURL: templateUrl
    };

I can't understand this error. The ClientRequestToken is clearly defined in the documentation for the createStack method: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFormation.html#createStack-property

The createStack call succeeds if I just comment out ClientRequestToken in the params object. So rest of my code seems to be ok.

I have posted this to the aws forums but there are no replies yet: https://forums.aws.amazon.com/thread.jspa?threadID=257033

Can someone please help with solving this?



via Koustubha Kale

No comments:

Post a Comment