Skip to content
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

Better error description when calling a subscribe on SubscribeToTopicRequest without a topic specified #247

Open
clogwog opened this issue Nov 2, 2021 · 1 comment
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue

Comments

@clogwog
Copy link

clogwog commented Nov 2, 2021

Is your feature request related to a problem? Please describe.
I made a mistake by subscribing to a topic but specifying a wrong data member as the topic

responserequest = SubscribeToTopicRequest()
responserequest.topic_name =  "$aws/things/mythingname/shadow/name/streamcontrol/update/delta"
g_shadow_handler = shadow_delta_handler()
g_delta_subscribe_operation = g_ipc_client.new_subscribe_to_topic(g_shadow_handler)
future = g_delta_subscribe_operation.activate(responserequest)
future.result()

notice my mistake by using topic_name instead of topic

because of the flexibility of python i didn't see any error when specifying topic_name which is not a member of the SubscribeToTopicRequest class.

The error i did see in the greengrass.log was :

2021-10-29T01:45:08.264Z https://forums.aws.amazon.com/ (Thread-6) software.amazon.awssdk.eventstreamrpc.ServiceOperationMappingContinuationHandler: Sending connect response for au.com.mtdata.smartdvr.gg_shadow_config. {}
2021-10-29T01:45:08.267Z https://forums.aws.amazon.com/ (Thread-6) com.aws.greengrass.ipc.common.ExceptionUtil: Unhandled exception in IPC. {}
java.lang.NullPointerException
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1690)
at com.aws.greengrass.builtin.services.pubsub.PubSubIPCEventStreamAgent.handleSubscribeToTopicRequest(PubSubIPCEventStreamAgent.java:160)
at com.aws.greengrass.builtin.services.pubsub.PubSubIPCEventStreamAgent.access$300(PubSubIPCEventStreamAgent.java:45)
at com.aws.greengrass.builtin.services.pubsub.PubSubIPCEventStreamAgent$SubscribeToTopicOperationHandler.lambda$handleRequest$1(PubSubIPCEventStreamAgent.java:237)
at com.aws.greengrass.ipc.common.ExceptionUtil.translateExceptions(ExceptionUtil.java:33)
at com.aws.greengrass.builtin.services.pubsub.PubSubIPCEventStreamAgent$SubscribeToTopicOperationHandler.handleRequest(PubSubIPCEventStreamAgent.java:230)
at com.aws.greengrass.builtin.services.pubsub.PubSubIPCEventStreamAgent$SubscribeToTopicOperationHandler.handleRequest(PubSubIPCEventStreamAgent.java:209)
at software.amazon.awssdk.eventstreamrpc.OperationContinuationHandler.onContinuationMessage(OperationContinuationHandler.java:271)
at software.amazon.awssdk.crt.eventstream.ServerConnectionContinuationHandler.onContinuationMessageShim(ServerConnectionContinuationHandler.java:53)

2021-10-29T01:45:08.270Z https://forums.aws.amazon.com/ (Thread-6) software.amazon.awssdk.eventstreamrpc.RpcServer: New connection code https://forums.aws.amazon.com/ for https://forums.aws.amazon.com/(2021-10-29T01:45:08.270133Z) - <null>. {}
2021-10-29T01:45:08.272Z https://forums.aws.amazon.com/ (Thread-6) software.amazon.awssdk.eventstreamrpc.ServiceOperationMappingContinuationHandler: aws.greengrass#GreengrassCoreIPC authenticated identity: au.com.mtdata.smartdvr.gg_shadow_config. {}

which is not very helpful to find and resolve the issue

Describe the solution you'd like
When subscribing using SubscribeToTopicRequest and there is no topic specified, perhaps have a clear message saying
"Can't subscribe as no topic has been specified"

Describe alternatives you've considered
The alternative is to follow the API from the start.. which is fully on me

Additional context
The original issue that lead to this issue being raised : https://forums.aws.amazon.com/thread.jspa?messageID=999711&#999711

@clogwog clogwog added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2021
@jmklix
Copy link
Member

jmklix commented Jan 6, 2022

Thanks for pointing this out. This is something that we will look at improving in the future.

@jmklix jmklix removed the needs-triage This issue or PR still needs to be triaged. label Jan 6, 2022
@jmklix jmklix added the p2 This is a standard priority issue label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants