gpt4 book ai didi

javascript - SNSDestination 导致意外的键错误

转载 作者:行者123 更新时间:2023-11-29 21:00:34 24 4
gpt4 key购买 nike

在为某些 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

目前的控制流程如下:

  • ses.createConfigurationSet()
  • sns.createTopic() //创建新的 TopicArn 用于:
  • ses.createConfigurationSetEventDestination()

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没有问题。

关于javascript - SNSDestination 导致意外的键错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46693424/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com