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 年前檢視次數 390 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南