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
MODÉRATEUR
demandé il y a 4 ans403 vues
1 réponse
0
Réponse acceptée

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
EXPERT
répondu il y a 4 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions