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

Can't subscribe to topic on a thingShadow #6

Closed
lukin0110 opened this issue Oct 14, 2015 · 0 comments
Closed

Can't subscribe to topic on a thingShadow #6

lukin0110 opened this issue Oct 14, 2015 · 0 comments

Comments

@lukin0110
Copy link

I try to subscribe to a non thing topic in a thingShadow but it throws an error. In the connect event I try to subscribe but it throws the following error 'TypeError: device.operation is not a function'. I'm using node 0.12.x.

My code:

    var thingName = config.awsiot.thingName;
    var deviceShadow = awsIot.thingShadow({
        keyPath: config.awsiot.keyPath,
        certPath: config.awsiot.certPath,
        caPath: config.awsiot.caPath,
        clientId: thingName + "Shadow",
        region: 'eu-west-1'
    });

    deviceShadow.on('connect', function() {
        winston.info("MQTT Shadow: connected");

        deviceShadow.register(thingName, {persistentSubscribe: true});

        deviceShadow.subscribe("hello");
    });

The stacktrace:

/Users/maartenhuijsmans/GitProjects/triflux/node_modules/aws-iot-device-sdk/thing/index.js:650
            device.operation( topic, options, callback );
                   ^

TypeError: device.operation is not a function
    at thingShadowsClient._nonThingOperation (/Users/maartenhuijsmans/GitProjects/triflux/node_modules/aws-iot-device-sdk/thing/index.js:650:20)
    at thingShadowsClient.subscribe (/Users/maartenhuijsmans/GitProjects/triflux/node_modules/aws-iot-device-sdk/thing/index.js:672:12)
    at thingShadowsClient.<anonymous> (/Users/maartenhuijsmans/GitProjects/triflux/src/iot.js:142:22)
    at emitNone (events.js:67:13)
    at thingShadowsClient.emit (events.js:166:7)
    at MqttClient.<anonymous> (/Users/maartenhuijsmans/GitProjects/triflux/node_modules/aws-iot-device-sdk/thing/index.js:291:13)
    at emitNone (events.js:72:20)
    at MqttClient.emit (events.js:166:7)
    at MqttClient._handleConnack (/Users/maartenhuijsmans/GitProjects/triflux/node_modules/mqtt/lib/client.js:667:10)
    at MqttClient._handlePacket (/Users/maartenhuijsmans/GitProjects/triflux/node_modules/mqtt/lib/client.js:271:12)
gkwicker added a commit that referenced this issue Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant