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
gefragt vor 3 Monaten77 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor 3 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen