首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SQS: AWS.SimpleQueueService.UnsupportedOperation:不支持SendMessage操作中的消息属性列表值

SQS: AWS.SimpleQueueService.UnsupportedOperation:不支持SendMessage操作中的消息属性列表值
EN

Stack Overflow用户
提问于 2021-07-19 05:27:42
回答 1查看 203关注 0票数 0

我正在使用aws-sdk-js将消息发送到AWS中的标准队列。下面是有效载荷,

代码语言:javascript
复制
{
  MessageBody: 'UUID',
  QueueUrl: 'https://sqs.eu-west-1.amazonaws.com/<account>/<queue-name>',
  DelaySeconds: 0,
  MessageAttributes: {
    attribute1: {
      StringValue: 'UUID',
      StringListValues: [],
      BinaryListValues: [],
      DataType: 'String'
    },
    attribute2: {
      StringValue: 'SQS',
      StringListValues: [],
      BinaryListValues: [],
      DataType: 'String'
    },
    attribute3: {
      StringValue: 'UUID',
      StringListValues: [],
      BinaryListValues: [],
      DataType: 'String'
    }
  }
}

代码片段,

代码语言:javascript
复制
const AWS = require('aws-sdk');

const sqs = new AWS.SQS();
const params = { /* the above object */ }
sqs.sendMessage(params).promise();

但是我得到了这个错误,

代码语言:javascript
复制
AWS.SimpleQueueService.UnsupportedOperation: Message attribute list values in SendMessage operation are not supported.

错误是什么?我需要把有效载荷串起来吗?

EN

回答 1

Stack Overflow用户

发布于 2021-07-19 13:35:47

您还没有给出生成消息的代码,所以很难判断不支持的值是如何进入有效负载的。

但是,没有用于消息属性值的“列表”dataType。aws docs。唯一支持的dataTypes是

  • String
  • Number
  • Binary
  • Custom (使用上述方法之一创建自定义字段,例如Number.EmployeeId)

java example from aws docs

在消息有效负载中,下面两个字段的值是列表dataTypes

代码语言:javascript
复制
  StringListValues: [],
  BinaryListValues: [],

您应该删除它们。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68433213

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档