Koustubha Kale
Koustubha Kale

Reputation: 1

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?

Upvotes: 0

Views: 623

Answers (1)

srisaiswaroop
srisaiswaroop

Reputation: 195

Current supported version of AWS JS SDK inside lambda environment seems to be 2.45.0 from this documentation reference. Where as the docs link you mentioned has the documentation for the latest version 2.69.0.

I tried finding the 'ClientRequestToken' in latest(2.69.0) and i was able to find it in the code. Where as when i tried finding it in version 2.45.0 , there is no 'ClientRequestToken' in the code. Which means that this feature is recently introduced.

Upvotes: 0

Related Questions