- Newest
- Most votes
- Most comments
It appears that you're encountering an issue when trying to publish to a topic that starts with "It appears that you're encountering an issue when trying to publish to a topic that starts with "$" using the AWS IoT Greengrass SDK. The error message suggests that topics starting with "$" are not allowed for direct publishing.
To publish to the basic ingest topic for AWS IoT Core rules, you should not include the "$aws/rules/" prefix in your topic name when using the Greengrass SDK. Instead, you should publish to the topic without this prefix.
Try modifying your code to remove the "$aws/rules/" part from the topic name:
await this.ipcClient.publishToIoTCore({ topicName: `${basicIngestRule}/${this.thingName}/${topic}`, qos, payload: publishMessage, retain, });
This should allow you to publish to the intended topic without encountering the error about topics starting with "$".
Remember that the AWS IoT Core rules engine will still process messages published to this topic as if they were published to the full basic ingest topic (including the "$aws/rules/" prefix). The Greengrass core handles the routing of these messages to the appropriate AWS IoT Core topic behind the scenes.
If you're still experiencing issues, make sure that your Greengrass component has the necessary permissions to publish to IoT Core topics. You may need to check your component's authorization policy to ensure it has the correct permissions for the "aws.greengrass#PublishToIoTCore" operation.quot; using the AWS IoT Greengrass SDK. The error message suggests that topics starting with "It appears that you're encountering an issue when trying to publish to a topic that starts with "$" using the AWS IoT Greengrass SDK. The error message suggests that topics starting with "$" are not allowed for direct publishing.
To publish to the basic ingest topic for AWS IoT Core rules, you should not include the "$aws/rules/" prefix in your topic name when using the Greengrass SDK. Instead, you should publish to the topic without this prefix.
Try modifying your code to remove the "$aws/rules/" part from the topic name:
await this.ipcClient.publishToIoTCore({ topicName: `${basicIngestRule}/${this.thingName}/${topic}`, qos, payload: publishMessage, retain, });
This should allow you to publish to the intended topic without encountering the error about topics starting with "$".
Remember that the AWS IoT Core rules engine will still process messages published to this topic as if they were published to the full basic ingest topic (including the "$aws/rules/" prefix). The Greengrass core handles the routing of these messages to the appropriate AWS IoT Core topic behind the scenes.
If you're still experiencing issues, make sure that your Greengrass component has the necessary permissions to publish to IoT Core topics. You may need to check your component's authorization policy to ensure it has the correct permissions for the "aws.greengrass#PublishToIoTCore" operation.quot; are not allowed for direct publishing.
To publish to the basic ingest topic for AWS IoT Core rules, you should not include the "$aws/rules/" prefix in your topic name when using the Greengrass SDK. Instead, you should publish to the topic without this prefix.
Try modifying your code to remove the "$aws/rules/" part from the topic name:
await this.ipcClient.publishToIoTCore({ topicName: `${basicIngestRule}/${this.thingName}/${topic}`, qos, payload: publishMessage, retain, });
This should allow you to publish to the intended topic without encountering the error about topics starting with "It appears that you're encountering an issue when trying to publish to a topic that starts with "$" using the AWS IoT Greengrass SDK. The error message suggests that topics starting with "$" are not allowed for direct publishing.
To publish to the basic ingest topic for AWS IoT Core rules, you should not include the "$aws/rules/" prefix in your topic name when using the Greengrass SDK. Instead, you should publish to the topic without this prefix.
Try modifying your code to remove the "$aws/rules/" part from the topic name:
await this.ipcClient.publishToIoTCore({ topicName: `${basicIngestRule}/${this.thingName}/${topic}`, qos, payload: publishMessage, retain, });
This should allow you to publish to the intended topic without encountering the error about topics starting with "$".
Remember that the AWS IoT Core rules engine will still process messages published to this topic as if they were published to the full basic ingest topic (including the "$aws/rules/" prefix). The Greengrass core handles the routing of these messages to the appropriate AWS IoT Core topic behind the scenes.
If you're still experiencing issues, make sure that your Greengrass component has the necessary permissions to publish to IoT Core topics. You may need to check your component's authorization policy to ensure it has the correct permissions for the "aws.greengrass#PublishToIoTCore" operation.quot;.
Remember that the AWS IoT Core rules engine will still process messages published to this topic as if they were published to the full basic ingest topic (including the "$aws/rules/" prefix). The Greengrass core handles the routing of these messages to the appropriate AWS IoT Core topic behind the scenes.
If you're still experiencing issues, make sure that your Greengrass component has the necessary permissions to publish to IoT Core topics. You may need to check your component's authorization policy to ensure it has the correct permissions for the "aws.greengrass#PublishToIoTCore" operation.
Sources
Publish/subscribe AWS IoT Core MQTT messages - AWS IoT Greengrass
Publish/subscribe local messages - AWS IoT Greengrass
Hi,
We have some examples to refer in this document: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-iot-core-mqtt.html, an important configuration you should configure in your deployment is accessControl May we confirm we've already configured that and the operation "aws.greengrass#PublishToIoTCore", "aws.greengrass#SubscribeToIoTCore" is ToIoTCore
If this still doesn't work, could you provide full logs and mask the sensitive data please?
Thanks
answered a year ago
Relevant content
asked 3 years ago

I want to confirm that if following these instructions do you still get the benefit of the basic ingest topic and not incurring normal message charges? Can you please point to the documentation on this?
Testing it in the console I can publish to the topic of $aws/rules/.... and it works as intended. when I publish to ${basicIngestRule}/${this.thingName}/${topic} it does not trigger my rule