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回答
1
承認された回答

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
回答済み 2年前
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
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ