MQTT publishes always yield: No subscription exists for the source

0

I have spent countless hours, going through countless tutorials and examples trying to get a basic "Hello, World" Lambda code snippit that publishes an MQTT message from Greengrass. They always give the following:

GreengrassTestHTTPandMQTT: ipc_client.py:64,HTTP Error 400:Bad Request, b'No subscription exists for the source arn:aws:lambda:us-east-1:583841319539:function:GreengrassTestHTTPandMQTT:1 and subject {WHATVERIUSE}

ALL the documentation and examples seem to be either for Greengrass v1 - or for the "old" web UI.

I have done my damndest at every possible opportunity to add any subscriptions where I can - i.e. in the GUI and make sure the recipie includes (as follows) - but nothing at all works.

Any idea? (I love AWS and even their IoT stuff - but seems like Greengrass is one of the absolutely most confusing, convoluted, poorly-documented thing I've ever used...)

"pubsubTopics": {
"0": {
"topic": "from/http",
"type": "PUB_SUB"
},
"1": {
"topic": "from/http",
"type": "IOT_CORE"
},
"2": {
"topic": "#",
"type": "PUB_SUB"
},
"3": {
"topic": "#",
"type": "IOT_CORE"
}
}

已提问 3 年前332 查看次数
3 回答
1

Thanks for the answer. I was not even AWARE there were "v1" vs "v2" API differences. I would strongly suggest sanitizing all documentation and example code. I know it is a big ask - but I can't help but feel that every single problem I have encountered with Greengrass (and it has been nearly nothing BUT problems) have been in that ALL of the documentation and examples I am encountering are outdated, and no longer pertinent in a standard V2 environment.

已回答 3 年前
0

Hello Bradley,
Thank you for using Greengrass V2. In order to publish from a Lambda in V2 using the V1 Lambda SDK you must use the Legacy Subscription Router component: https://docs.aws.amazon.com/greengrass/v2/developerguide/legacy-subscription-router-component.html
This allows you to specify routes from given lambdas to either the cloud (AWS IoT Core) or another lambda on the device.

Please have a look at the Move from V1 to V2: https://docs.aws.amazon.com/greengrass/v2/developerguide/move-from-v1.html#run-v1-lambda-functions

Subscriptions

If your Lambda function publishes messages to the local publish/subscribe broker or to AWS IoT Core, specify aws.greengrass.LegacySubscriptionRouter as a component dependency when you import the function. When you deploy the legacy subscription router component, specify the subscriptions that the Lambda function uses. For more information, see Legacy subscription router.

I would highly suggest however that you consider using a native Greengrass V2 component, especially if you are not migrating from Greengrass V1. Greengrass V2 native components can use our V2 IPC SDK: https://docs.aws.amazon.com/greengrass/v2/developerguide/interprocess-communication.html which will allow you to publish and subscribe to topics without setting up static configuration for those "routes" (except for accessControl policies to allow publish or subscribe).

Cheers,
Michael

AWS
专家
已回答 3 年前
0
<Resolved>

Edited by: Bradley Goodman on Nov 12, 2021 6:43 PM

已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则