Number messageAttribute delivered as String in Lambda subscriber to SNS Topic

0

I have 2 listeners on a SNS Topic, a JSON-email and Lambda. When i send a message with MessageAttributes of type Number, I do get them als Numbers in my JSON-email, but as strings in my Lambda event. The same message, with the same messageId looks like this:

  "MessageAttributes" : {
    "Active" : {"Type":"Number","Value":"0"}
  }

and

  "MessageAttributes" : {
    "Active" : {"Type":"String","Value":"0"}
  }

Is this a bug, or am I doing something wrong?

2 Answers
1
Accepted Answer

SNS messageAttributes of type Number is sent to lambda event as type String. But this is a not a bug as per AWS documentation. https://docs.aws.amazon.com/sns/latest/dg/sns-message-attributes.html

Number data type isn't supported for AWS Lambda subscriptions. If you specify this data type for Lambda endpoints, it's passed as the String data type in the JSON payload that Amazon SNS delivers to Lambda.

prabu
answered 2 years ago
0

Right, I missed that. I can't really understand why that would not be support on Lamda's though. It would still be the same StringValue, only the Type would be differently named.

CP_2022
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions