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
asked 3 months ago63 views
1 Answer
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
EXPERT
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions