mqtt: PUBLISH: Pubsub topic missing

331 views
Skip to first unread message

Chris Wren

unread,
Sep 24, 2018, 1:33:42 PM9/24/18
to Google Cloud Pub/Sub Discussions
I'm working through the sample at: 


I have a registry:

  example-registry
 
with a topic:

  projects/project-id/topics/events

a subscription on that topic: 

  projects/project-id/subscriptions/my-sub

and a device

  my-rs256-device

but when I run the example it says: 

Publishing message 8/100: 'example-registry/my-rs256-device-payload-8'
Sending on topic /devices/my-rs256-device/events
Sending paylad example-registry/my-rs256-device-payload-8
('on_connect', 'Connection Accepted.')
('on_disconnect', '1: Out of memory.')

and the device console
says 
  mqtt: PUBLISH: Pubsub topic missing

web search doesn't seem to know about this error. 

clue welcome

Tianzi Cai

unread,
Sep 24, 2018, 9:01:13 PM9/24/18
to Google Cloud Pub/Sub Discussions
Have you created the Pub/Sub topic? You can check that by checking Pub/Sub>Topics in https://console.cloud.google.com

Chris Wren

unread,
Sep 25, 2018, 2:00:11 PM9/25/18
to Google Cloud Pub/Sub Discussions
It turns out that for iioT you need to both make the topic and then also map it to an mqtt topic.

I needed to select the pubsub topics as the default telemetry topic and the default config topic.

but I skipped that part because I started following a different, out-of-date example and by the time I found the up-to-date one I'd already created my registry so I skipped it.

Hopefully this will become the search hit for the "mqtt: PUBLISH: Pubsub topic missing" error string, so that people can find out what they did wrong. 

thanks!

Alex Hong

unread,
Sep 25, 2018, 7:00:32 PM9/25/18
to Google Cloud Pub/Sub Discussions
Was the out-of-date example that you followed something that you accessed recently? 

Also, I was about to reply to this but I'm glad you managed to get it working in the end. I actually tried this example earlier today and managed to get it working (I think the interface for creating registries forces you to assign a telemetry topic now).

Tianzi Cai

unread,
Sep 27, 2018, 1:38:39 PM9/27/18
to Google Cloud Pub/Sub Discussions
Glad to hear it's working now too! I followed two QwikLabs to learn IoT Core myself. The step to create a Pub/Sub topic is somewhere in the lab. Providing the links to them: 



// The MQTT topic that this device will publish data to. The MQTT
// topic name is required to be in the format below. The topic name must end in
// 'state' to publish state and 'events' to publish telemetry. Note that this is
// not the same as the device registry's Cloud Pub/Sub topic.
const mqttTopic = `/devices/${argv.deviceId}/${argv.messageType}`;

Chris Wren

unread,
Sep 30, 2018, 3:12:04 PM9/30/18
to Google Cloud Pub/Sub Discussions
it was Arm-based IoT Kit for Cloud IoT Core. I already sent them some feedback about it. The command-line version of the registry creation left me without mqtt mappings. Maybe that's a bug in the command-line tool, if it's intended to enforce that? By "interface for creating registries" I assume you mean the web interface.

Alex Hong

unread,
Oct 16, 2018, 8:24:04 AM10/16/18
to Google Cloud Pub/Sub Discussions
Ah ok. Yeah, that does look a little out of date. And yes, I did mean the web interface (I attached a screenshot of the UI requiring you to select a telemetry topic). 

Screen Shot 2018-10-15 at 2.34.59 PM.png

Reply all
Reply to author
Forward
0 new messages