-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Greengrass Component IPC Subscription not receiving messages #407
Comments
What does your component's accessControl block look like? |
Hi, @bretambrose
I also tried with aws.greengrass.ipc.pubsub but the result was the same regarding the subscription to local topics, with the added problem of the component getting unauthorized when trying to publish to IoT Core. Is there something wrong with the block? |
Still confirming with Greengrass, but I believe your policy is incorrect. You can only whitelist operations under blocks ("aws.greengrass.ipc.mqttproxy") that correspond to the associated set of operations. For iot core mqtt operations, "aws.greengrass.ipc.mqttproxy" is correct, but for local mqtt data flows, you'll want to use "aws.greengrass.ipc.pubsub" See the accessControl block in the authorization policy example for https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-publish-subscribe.html |
Thinking further though, you should have seen an exception when you tried to subscribe without permission. That is a bit puzzling and warrants further investigation (I constantly mess up permissions and get exceptions) |
Can you please provide the full code? You've shown the subscription, but not the publish. |
At first i was using ""aws.greengrass.ipc.pubsub" and was only white listing "aws.greengrass#PublishToTopic" and "aws.greengrass#SubscribeToTopic" and I was still not getting any messages. When I ran into this issue, out of curiosity, I tried to publish and subscribe to IoT Core from my component and that is when I changed the accessControl block to its current form. Also, if when you use "aws.greengrass.ipc.mqttproxy" you are only allowed to use IoT Core mqtt operations, then what exactly can you proxy? And why is my component able to publish locally? I have been searching everywhere for an answer, I didn't fancy disturbing you guys but I am at a loss right now quite honestly, so before trying another language, I decided to ask for your input. |
Greengrass local publish/subscribe and MQTT are different protocols. The MQTT will go to IoT Core, you do not use the MQTT Bridge component to do this. It is a "proxy" because your component does not connect to IoT Core directly, it goes through Greengrass to send the MQTT message to IoT Core. What are you actually trying to do? Are you trying to publish and subscribe to messages within the local device, or to IoT Core? From the documentation:
|
Because you are publishing from the same component that you're subscribing from, Greengrass is not delivering the message to you by default. This behavior only applies to local publish/subscribe, not MQTT. You can change this behavior in the subscribe request by setting the |
Dear @MikeDombo here is the full code:
|
Dear @MikeDombo What I am trying to do is the following: I have a greengrass client device that publishes to moquette, from moquette I proxy the messages to IPC via mqttbridge component, and I want my custom component to subscribe to the relevant topic, receive these messages, process them, and then send them on to IoT core deppending on the implemented logic (either by publishing to IoT Core via the ipcClient, or alternatively by publishing locally and having the mqttbrige component proxying the messages to IoT Core) It does look like you already pointed out what is the issue :) |
Dear @MikeDombo and @bretambrose thank you very much for the help. It was working all along, it was just that by default, as Mike promptly pointed out, the local subscription will ignore messages published by the same component, which erroneously lead me to believe there was something wrong. Thank you again, and forgive me for taking your time. Have a great day. |
|
Describe the bug
Hi Team,
thank you in advance for your time, and please forgive me if I am doing something that is not according to the guidelines, it is the first time I am opening an issue.
I followed the documentation here and tried to implement a PubSub custom greengrass component in order to process messages at the edge. It successfully subscribes/publishes to IoT Core, and publishes locally on IPC, however, subscribing to a local IPC topic just doesn't work, there are no errors whatsoever but the subscription does not receive any messages, the message event is never triggered.
I publish messages via the same IPC Client and the mqtt bridge proxies them to IoT Core but I am not being able to have my component receive local messages via the stream operation.
Expected Behavior
I expected to receive the messages published to local IPC topics but I get nothing. No errors, no messages.
Current Behavior
Despite my IPC Client seemingly being correctly instantiated, since it is able to publish locally and publish and subscribe to IoT Core without any issues, when I try to subscribe (see code below) locally to '#', even though there are no errors, the message event never triggers.
See the logs below, the Client is instantiated without issues, the subscriptions both to IoT Core and IPC also do not throw any error, but then, the message I am publishing inside a setInterval() block does not trigger the message event:
These messages published to local/self are picked up by the mqtt bridge and proxied to IoT Core, so publishing to IPC is working, it's just that the subscription doesn't.
Reproduction Steps
Possible Solution
Is there something wrong with my subscribing code?
Additional Information/Context
No response
SDK version used
1.14.0
Environment details (OS name and version, etc.)
ubuntu-jammy-22.04-amd64-server-20230516
greengrass nucleus 2.11.0
The text was updated successfully, but these errors were encountered: