IoT Core Rule does not trigger lambda with binary payload

0

Hi all, I have a rule on an IoT Topic with this SQL statement:

SELECT aws_lambda("${converter.lambda_arn}",{'base64Payload' : encode(*,'base64')}) as data, clientid() AS clientid, topic(4) as thing_id, topic() as topic, CASE isUndefined(ts) WHEN True THEN timestamp() ELSE ts END as ts FROM 'ask/dt/#'

I setted logging level in my AWS-IoT settings to "DEBUG"

  • If I send a JSON string payload everything works fine, the ${converter.lambda_arn} function has been invoked
  • If I send a non-JSON string payload, I got a 'JSONParseError' on the RuleExecution event (${converter.lambda_arn} is not invoked)
  • If I send a binary payload (that is what i want to do) I do not see any RuleExecution log (but I see a RuleMatch - success log)

I'm using Mosquitto client from shell to send messages

Can anybody help me to understand what is happening? How can I get binary payloads to trigger converter lambda?

Thank you!

Gab
已提問 3 個月前檢視次數 77 次
1 個回答
0

To handle your message payload as raw binary data (rather than a JSON object), you can use the * operator to refer to it in a SELECT clause. Some rule actions don't support binary payload input, such as a Lambda action, so you must decode binary payloads. The Lambda rule action can receive binary data, if it's base64 encoded and in a JSON payload. Please refer https://docs.aws.amazon.com/iot/latest/developerguide/binary-payloads.html

profile pictureAWS
專家
已回答 3 個月前

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

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

回答問題指南