1
votes

I am currently using the javascript AWS Iot SDK. Adapting the example provided here, I have been able to register with my thingShadow, and I am trying to publish an update after registration. However, when I do, I get the following error message:

cannot publish to reserved topic '$aws/things/<thingName>/shadow/update'

I understand the '$' indicates that this is a reserved topic, but Amazon's documentation (http://docs.aws.amazon.com/iot/latest/developerguide/topics.html) states that publish and subscribe operations are allowed for this reserved topic. If that is the case, I am not sure why my attempt to publish is resulting in an error. This snippet demonstrates how I attempt to publish in my connection callback:

shadows.register(<thingName>, {
    persistentSubscribe: true
}, () => {
    shadows.publish('$aws/things/<thingName>/shadow/update', <message>);
});
1
At the risk of asking a ridiculous question, you're not literally using the characters <thingName> in the literal string you've shown at shadows.publish('$aws/things/<thingName>/shadow/update', <message>);... right? There's an actual valid thing name here?Michael - sqlbot
@Michael-sqlbot Haha, fair question. Yes, I am currently using a valid thingName and message in those strings.Starfish_Prime

1 Answers

2
votes

I see that you are using the thing shadow class of the SDK to publish on a reserved topic. By looking at the source code of the SDK, I see that it is not possible to publish on a reserved topic using this type of client, since all operations on reserved topics are conducted by .register() and .update().

You can however publish on these reserved topics by using the device class.