IoT Events custom payload error

0

I'm trying to use IoT Events custom payload with Lambda action. When I pass a JSON list format data from input and use it in the Lambda Action with JSON payload the following error occurs:

We couldn't evaluate your expression for the action. Make sure that the variable names, input names, and paths to the data refer to the existing variables and input values. Note that the maximum allowable size of the payload is 1KB.

input json

{
	"thingname": "test device",
	"status": [
          {
              "device1": "normal"
          },
          {
              "device2": "error"
          }
        ]
}

custom payload for Lambda

"{\"thingname\": \"${$input.inputname.thingname}\", \"device_status\": ${$input.inputname.status}}"

Does the custom payload not support JSON data? Or am I missing something?

AWS
モデレーター
質問済み 4年前404ビュー
1回答
0
承認された回答

Not having tested it but quick guess: $input.inputname.status is a list. Might be a list is not considered to be a datum.

Try the following:

{
    "thingname": "test device",
    "status": "somestatus"
}
AWS
エキスパート
回答済み 4年前

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

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

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

関連するコンテンツ