Skip to content

Greengrass local IPC Pub/Sub between components using AWS-SDK-CPP-v2

0

Hi

I configured an embedded linux device as a greengrass core device with Nucleus(2.14.3) installed. I need to test local IPC Pub/Sub between components. From the source https://docs.aws.amazon.com/greengrass/v2/developerguide/interprocess-communication.html followed the steps and when I deploy and run the component I keep getting the error Failed to establish connection with error EVENT_STREAM_RPC_NULL_PARAMETER or Failed to establish connection with error EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED. I have enabled the iot and greengrass policy for the core-device and thing-group. Any help would be appreciated.

The json file is: {
"RecipeFormatVersion": "2020-01-25",
"ComponentName": "com.example.PubSubPublisherCpp",
"ComponentVersion": "1.0.0",
"ComponentDescription": "A component that publishes messages.",
"ComponentPublisher": "Amazon",
"ComponentConfiguration": {
"DefaultConfiguration": {
"accessControl": {
"aws.greengrass.ipc.pubsub": {
"com.example.PubSubPublisherCpp:pubsub:1": {
"policyDescription": "Allows access to publish to all topics.",
"operations": [
"aws.greengrass#PublishToTopic"
],
"resources": [
"*"
]
}
}
}
}
},
"Manifests": [
{
"Lifecycle": {
"RequiresPrivilege": true,
"Run": "{artifacts:path}/greengrassv2_pubsub_publisher"
}
}
]
}

1 Answer
1

It seems you're encountering issues with local MQTT Pub/Sub communication between components in AWS IoT Greengrass. The errors you're seeing suggest there might be some configuration or permission issues. Let's go through a few points to help troubleshoot:

  1. First, ensure that you're using the correct IPC mechanism for component-to-component communication in Greengrass. The local publish/subscribe interface is separate from MQTT and uses a different API.

  2. Check your component's recipe file. Make sure you've properly configured the access control policy for IPC communication. Your component needs explicit permission to use the publish/subscribe API. The recipe should include something like this:

ComponentConfiguration:
DefaultConfiguration:
accessControl:
aws.greengrass.ipc.pubsub:
'YourComponentName:pubsub:1':
policyDescription: Allows access to publish/subscribe to all topics
operations:
- aws.greengrass#PublishToTopic
- aws.greengrass#SubscribeToTopic
resources:
- '*'
  1. Verify that you're using the correct API calls in your code. For local publish/subscribe, you should be using methods like PublishToTopic and SubscribeToTopic, not MQTT-specific methods.

  2. The error "EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED" specifically points to a permissions issue. Double-check that your component has the necessary permissions in its recipe.

  3. Make sure you're using the appropriate SDK and methods for Greengrass V2 IPC communication. The AWS SDK for C++ v2 should work, but ensure you're using the Greengrass-specific IPC client.

  4. If you're trying to communicate between components and client devices, note that this requires additional configuration. You would need to deploy and configure the MQTT bridge component to relay messages between the local publish/subscribe interface and client devices.

If you've verified all these points and are still encountering issues, you may want to review the Greengrass logs for more detailed error information. Also, ensure that your Greengrass core device has the latest updates and that all necessary components are properly deployed and running.
Sources
Interact with client devices in components - AWS IoT Greengrass
Greengrass local MQTT retained flag | AWS re:Post
UnauthorizedError when trying to publish data to local MQTT topic using AWS IoT Greengrass V2 IPC | AWS re:Post

answered 9 months ago
AWS
EXPERT
reviewed 9 months ago
  • The error "EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED" specifically points to a permissions issue. Double-check that your component has the necessary permissions in its recipe.

    Whether the certificates or Access key that we are providing causes this issue

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.