对运行时Node.js使用lambda函数6.10
我试图在调用createStack时将客户端提供的令牌(字符串)包含为ClientRequestToken
如果我在传递给createStack函数的参数中包含ClientRequestToken,我会收到以下错误:
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)
以下是我创建params对象的方法:
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
};
我无法理解这个错误。 ClientRequestToken在createStack方法的文档中明确定义:http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFormation.html#createStack-property
如果我只是在params对象中注释掉ClientRequestToken,那么createStack调用会成功。所以其余的代码似乎没问题。
我已将此发布到aws论坛,但尚无回复:https://forums.aws.amazon.com/thread.jspa?threadID=257033
有人可以帮忙解决这个问题吗?
答案 0 :(得分:0)
lambda环境中当前支持的AWS JS SDK版本似乎是documentation reference的2.45.0。您提到的文档链接的位置有最新版本2.69.0的文档。
我尝试找到' ClientRequestToken'在latest(2.69.0),我能够在代码中找到它。当我尝试在version 2.45.0中找到它时,没有' ClientRequestToken'在代码中。这意味着最近推出了此功能。