Greengrass v2 interact with shadows from a nodejs lambda

0

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.

JAG
gefragt vor 2 Jahren351 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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.

AWS
beantwortet vor 2 Jahren
profile picture
EXPERTE
überprüft vor 10 Monaten
  • 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.log for 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.

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