Greengrass v2 interact with shadows from a nodejs lambda
Is there any way to interact with local shadows in ggv2 from a nodejs lambda? I know IPC is not supported in the js sdk, but maybe an mqtt client in a lambda could connect to the mqtt components. Thanks in advance for any ideas other than a python rewrite which I am working on, but, looking for a solution to get ggv2 running with ggv1 lambdas while working on python conversion.
Currently IPC is the only available method for communicating with the local shadow manager. However, the next release of Shadow Manager will support a PubSub API (code) which will enable you to access shadows via MQTT (as long as you configure the appropriate routes in the MQTT Bridge component).
There are downsides to your approach, as you'll need to model your lambda as a client device and give it a private key / cert. But it should serve as a stop gap solution.
Awesome! I tried creating a device and using the certs and the aws-iot-device-sdk-v2 js mqtt client from a lambda but I get an AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE TLS (SSL) Negotiation failed. Is this expected until the updates you mention? I have not been able to get a lambda function as a device to connect to the local MQTT broker. Thanks for all your responses.
You won't be able to get this working end-to-end until the next Shadow Manager release. However, you should be able to get the MQTT connection to work.
We have a detailed tutorial on how to set up client devices here: https://docs.aws.amazon.com/greengrass/v2/developerguide/client-devices-tutorial.html
TLS failures are usually caused by your client using an incorrect CA, or Greengrass not having sufficient permissions in the certificate policy to verify the client certificate. Both are covered in the above tutorial.
You can check
greengrass.logfor hints. Anything along the lines of "bad_ca" points to an issue with the client. Otherwise it's likely a Greengrass configuration issue and the logs should point you in the right direction.
Best way to restart a Greengrass component, from another componentasked 6 months ago
How do you use the local shadow service from a connected device in GG v2?asked 9 months ago
Proper way to interact with resources/services outside of GG v2asked a year ago
Roadmap for Greengrass v2 feature parity with v1?asked a year ago
Profiling memory for a NodeJS Lambda functionasked 6 months ago
NodeJs server SDKasked 5 years ago
How to use JS SDK V3 to getItem from DAX: "@aws-sdk/client-dax" instead of "amazon-dax-client"Accepted Answerasked 5 months ago
Greengrass v2 interact with shadows from a nodejs lambdaAccepted Answerasked 19 days ago
unable to Sub scribing with Mqtt data in AWS IoT core with greengrass deploymentasked 2 months ago
Publish to iot core from an imported lambda using greengrassv2asked a year ago