Ghost Lambdas responding to IoT Cloud subscriptions


Dear GG users -
I have 2 GG Core devices with no Things connected to them.

I want to trigger from AWS Cloud to GG Core (& wait for response). My solution has these pieces:

A. Lambda Function-1 (SendRequest-ReadReply)
Running on AWS, does pub/sub to/from IoT Cloud (say on mqtt/requestTopic & mqtt/replyTopic).
Built using AWSIoTPythonSDK, connected to IoT Cloud via WebSockets.

B. Lambda Function-2 (SendResponse)
Running on AWS GreenGrass Core device, receives events from mqtt/requestTopic (subscription via GG console) and explicitly publishes a response to mqtt/replyTopic.
Built using GreengrassSDK, connected to IoT Cloud via iot-data client

Now the question:

When my GG Core is up and running / healthy, everything seem to work.
When my GG Core is down, my Lambda-1 does get GHOST responses from somewhere with a different reply than I expected.
Is there something (like shadow) baked into AWS IoT Cloud which is replying on behalf of GG Core device (even when it's down???).

PS: I want the request to be run by the GG Core device only (and not by anyone else).

Any help is appreciated! :)


Edited by: rgrandhi on Oct 8, 2019 10:48 PM

asked 3 years ago22 views
3 Answers

Hi rgrandhi,

Since your question is more about the cloud lambda side I'm going to reassign this question. What rules do you have setup to trigger your cloud Lambda, Lambda 1? Are you using wildcards?


answered 3 years ago

Hi there!
No, there are no rules triggering Lambda 1, I use StepFunctions to invoke it manually (for now).
Yes, there are wildcard subscriptions involved in this in the following format.

Lambda1 (on Cloud) --> publishes to topic --> CMD/are_you_alive/<lambda's context.aws_request_id>
Lambda1 (on Cloud) --> starts to subscribe to --> RESULT/are_you_alive/<lambda's context.aws_request_id>
Lambda2 (on GG Core device) --> with a GG subscription to topic --> CMD/are_you_alive/+
Lambda2 (on GG Core device) --> publishes its response to --> RESULT/are_you_alive/<whatever aws_request_id it received from Lambda1 as a part of request body>

I repeat my problem, if it helps with clarity:
I'm getting responses from Lambda2 despite the GG Core device is down!!!!!!??

On a side note, is there a recommended way to publish/subscribe to IoT cloud messages from Lambda1 (running on Cloud). PS: I got inspiration from PubSub example from AWS GitHub (AWSIoTPythonSDK).

Appreciate your help!


answered 3 years ago

Hello -
I found the solution to my problem.

It is not an issue with Lambda or GreenGrass as I doubted earlier.

I have a global scoped variable declared in my Lambdas, so, when AWS is reusing Lambda runtime(s) between invocations, I'm getting unwanted results in its response.

Just wanted to put an end to this thread as closure :)


answered 3 years 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