SNSDestination 导致意外的键错误

SNSDestination causing unexpected key error

在为某些 AWS SES 事件创建配置集事件目标时,我 运行 遇到此错误。这是我传递给 ses.createConfigurationSetEventDestination():

的参数
const destinationParams = {
  ConfigurationSetName: instance.id,
  EventDestination: {
    Name: instance.id,
    MatchingEventTypes: ['send', 'reject', 'bounce', 'complaint', 'delivery', 'open', 'click'],
    Enabled: true,
    SNSDestination: {
      TopicARN: topicArn,
    },
  },
};

我得到的错误是

UnexpectedParameter: Unexpected key 'SNSDestination' found in params.EventDestination

到目前为止的控制流程如下:

These are the docs I'm referencing

我正在改进我之前的回答:

我配置了 node.js sdk 并尝试重现该问题。我能够成功创建 ConfigurationSet 并设置 EventDestination

代码:

var AWS = require('aws-sdk');
AWS.config.update({region:'us-east-1'});
var ses = new AWS.SES();

/*const params1 = {
  ConfigurationSet: { 
    Name: 'test'
  }
};
ses.createConfigurationSet(params1, function(err, data) {
  if (err) console.log(err, err.stack); 
  else     console.log(data);           
}); */

const destinationParams = {
  ConfigurationSetName: 'test',
  EventDestination: {
    Name: 'testevent',
    MatchingEventTypes: ['send', 'reject', 'bounce', 'complaint', 'delivery', 'open', 'click'],
    Enabled: true,
    SNSDestination: {
      TopicARN: 'arn:aws:sns:us-east-1:XXXXXXXXXXX:test',
    },
  },
};
ses.createConfigurationSetEventDestination(destinationParams, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

响应:

{ ResponseMetadata: { RequestId: '838b95ae-af35-11e7-a190-c960102424be' } }

所以 node.js sdk 没有问题。