发布消息的功能
this.sns = new SNS({ apiVersion: '2010-03-31', region: <region> });
async publishMessage() {
try {
const params = {
MessageGroupId: 'test',
MessageDeduplicationId: uuidv4(),
Message: 'test',
TopicArn: 'arn:aws:sns:<region>:<accountID>:item-dev-topic.fifo',
};
const res = await this.sns.listTopics().promise();
// Works : this returns the topic which I plan to use
const response = await this.sns.publish(params).promise();
// Fails : this line gives error saying multiple invalid param (MessageGroupId, MessageDeduplicationId)
console.log(response);
return res;
}
catch (error) {
throw new Error(error);
}
}
错误:说出多个无效参数(MessageGroupId,MessageDeduplicationId) 当我删除此参数时,它表示那些参数丢失,而当我添加这些参数时,它表示无效参数。
观察:
答案 0 :(得分:1)
将AWS开发工具包升级到最新版本 解决了这一重大问题
SDK版本出现错误:v2.744.0
升级到 v2.784.0 可以解决上述问题