来自Amazon SQS Javascript SDK的Bizzare行为(sendMessage)

时间:2017-01-07 20:15:26

标签: javascript amazon-web-services amazon-sqs

我在这里的绳子尽头,所以我会保持简短。这是我的代码示例:

var message = JSON.stringify(value)
var url = process.env.SQS_URL + 'ts-notifications'
services.queue.sendMessage({
    MessageAttributes: {
        "responseId": {
            DataType: 'String',
            StringValue: responseIdentifier.toString('hex', true)
        },
        "surveyId": {
            DataType: 'String',
            StringValue: surveyIdentifier.toString('hex', true)
        },
        "itemId": {
            DataType: 'String',
            StringValue: key
        }
    },
    MessageBody: message,
    QueueUrl: url,
    DelaySeconds: 0
}, function(err, data) {
    if (err) {
        cb(err)
    } else {
        cb()
    }
})

运行此操作会出现此错误:

{ [UnexpectedParameter: Unexpected key 'MessageAttributes' found in params] message: 'Unexpected key \'MessageAttributes\' found in params', code: 'UnexpectedParameter', time: Sat Jan 07 2017 20:06:33 GMT+0000 (UTC) }

以下是指向sendMessage的AWS SQS Javascript SDK的链接:http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SQS.html#sendMessage-property

对我来说,似乎很清楚MessageAttributes是sendMessage的有效参数。我对所有建议持开放态度,因为这个建议让我感到难过!

P.S。,是的,我正在使用正确的API版本(无论如何只有一个版本),上面的变量对应于代码中更高的有效内容。

全部谢谢!

0 个答案:

没有答案