Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda not getting invoked when binary data posted in AWS IOT?

I have configured a lambda to a IOT Rule. The MQTT topic will get binary data and on arrival of data the rule should invoke lambda.

The lambda gets invoked when I post normal JSON data, but if I post any binary data, the lambda does not get invoked.

But at the same time, I am able to consume the binary data posted to MQTT through my stand alone consumer and able to deserialise it successfully.

So what is that I am missing here ?

like image 229
shoki Avatar asked Apr 06 '26 21:04

shoki


1 Answers

When the message payload should be handled as raw binary data (rather than a JSON object), you can use the * operator to refer to it in a SELECT clause.

Do this on your rule:

SELECT encode(*, 'base64') AS data, timestamp() AS ts FROM 'a/b'

This way it will get invoked.

https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-select.html

like image 171
Deividi Silva Avatar answered Apr 08 '26 11:04

Deividi Silva



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!