I'd like to publish a message to my sns topic.
I'm using js "aws-sdk/client-sns" with the snsClient.send(new PublishCommand(params)
.
Subscribed to my sns topic there is a sqs queue with a filter sub policy.
The issue is with the message attributes, I want to send as value a json object as in this example:
MessageAttributes: { filter: { DataType: 'String', StringValue: "filter" } }, object: { DataType: 'String', StringValue: JSON.stringify( object ) } }
the message never get to the queue and fails under "NumberOfNotificationsFilteredOut" or "NumberOfNotificationsFilteredOut-InvalidAttributes".
Instead, if the queue does not have a filter sub policy or I set the object as DataType: 'String.Array'
the message arrive without any problem, is this a bug? How should I set my message attribute if I want to send an Object ? Thanks.
Thanks for the info, but this is not what I'm looking for, I want to know if there is a correct way to send an Object as a message attribute, and why if sent as "DataType: String" is messing up with the filter policy, while with "String.Array" there is no problem.