Description
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:
2023-07-20T11:10:50.872Z [INFO] (Copier) genericPubSubComponent: stdout. Client ready. {scriptName=services.genericPubSubComponent.lifecycle.run.Script, serviceName=genericPubSubComponent, currentState=RUNNING}
2023-07-20T11:10:50.878Z [INFO] (Copier) genericPubSubComponent: stdout. [Local][IPC]_Subscribed to #. {scriptName=services.genericPubSubComponent.lifecycle.run.Script, serviceName=genericPubSubComponent, currentState=RUNNING}
2023-07-20T11:10:50.921Z [INFO] (Copier) genericPubSubComponent: stdout. [Iotcore]_Subscribed to iotcore2greengrass/#. {scriptName=services.genericPubSubComponent.lifecycle.run.Script, serviceName=genericPubSubComponent, currentState=RUNNING}
2023-07-20T11:11:20.932Z [INFO] (Copier) genericPubSubComponent: stdout. [Local][IPC]_Message published to local/self. {scriptName=services.genericPubSubComponent.lifecycle.run.Script, serviceName=genericPubSubComponent, currentState=RUNNING}
2023-07-20T11:11:50.959Z [INFO] (Copier) genericPubSubComponent: stdout. [Local][IPC]_Message published to local/self. {scriptName=services.genericPubSubComponent.lifecycle.run.Script, serviceName=genericPubSubComponent, currentState=RUNNING}
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
async subscribeToLocal(topic) {
try {
const subscribe_request ={
topic: topic
}
await this.ipcClient.subscribeToTopic(subscribe_request).on('message', (message) => {
console.log(JSON.stringify(message))
}).on('streamError', (error) => {
console.error('[Local][IPC]_Stream error:', error)
}).on('ended', () => {
console.log('[Local][IPC]_Streaming operation ended')
}).activate()
console.log(`[Local][IPC]_Subscribed to ${topic}`)
} catch (error) {
console.error(`[Local][IPC]_error subscribing: ${error}`)
}
}
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