amazon-web-services - AWS SNS 发布:无法为 Node.js 发布 FIFO 消息
问题描述
发布消息的功能
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) 当我删除此参数时,它说这些参数丢失,当我添加这些参数时,它说无效参数。
观察:
- 这适用于不是 Fifo 的 SNS 主题
- 列表主题适用于 Fifo 和标准 SNS 主题,它包括我所需的 SNS 主题
解决方案
将 AWS 开发工具包升级到最新版本修复了这个重大问题
出现错误的 SDK 版本:v2.744.0
升级到v2.784.0解决了上述问题
推荐阅读
- python - 张量流中的 RMSE 究竟是如何计算的?
- spring - 使用拦截器修改路径参数(Spring mvc)
- laravel - 使用格式时出错:Laravel 中的 $table->date('column_name')
- javascript - 嵌套的 firebase.database 功能不起作用
- docker - 如何在 ubuntu 16.04 docker 容器上安装 spyder3
- javascript - 从 javascript 通过端口停止进程
- python - 使用带有 lambda 函数的 applymap 时如何获取列名?
- r - 在R中将行堆叠为列
- c - Recvfrom() 没有接收到发送到系统的所有数据
- java - 使用 ModelMapper 的 SOAP 请求映射