smart home iot thing trouble publishing from lambda to iot thing


If i test publish to my iot thing inTopic from MQTT, it works fine. When I try and publish from lambda i get nothing. I am stumped. What can I check?
Here is a snippet of my lambda publish code:

var config = {
  "thingName": 'garageThing',
  "endpointAddress": "",
  "region": "us-east-1"
function publish() {
  console.log("in publish");
  var params = {
    topic: 'inTopic',
    payload: 'Hello from lambda',
    qos: 0
  var iotData = new AWS.IotData({endpoint: config.endpointAddress});
  iotData.publish(params, function(err, data) {
    console.log("in publish callback");
        console.log("\nSuccess, I guess.\n");
asked 3 years ago14 views
1 Answer

Turns out it was a callback timing issue. I painfully started with a working example and converted it a few lines at a time until it started failing. Then it was obvious.

answered 3 years ago

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.

Guidelines for Answering Questions