superfeedr / superfeedr-node

A library to interract with Superfeedr's XMPP API in any node application
http://superfeedr.com/documentation#xmpp_pubsub
31 stars 17 forks source link

TypeError: xmpp.Iq is not a constructor #29

Open JimLynchCodes opened 4 years ago

JimLynchCodes commented 4 years ago

Hello! I am trying to run the example file with node v10.19.0.

Here is my code:

var Superfeedr = require('superfeedr');

client = new Superfeedr("Eonjim", "[my_actual_password]");
client.on('connected', function () {

    console.log('connected!');
    client.subscribe("http://blog.superfeedr.com/atom.xml", function (err, feed) {

          console.log('subscribed!', feed);
    });
});

It seems to be successfully connected, but when trying to subscribe to any feed I just get the same error...

Here is the error output I'm seeing:

(node:78407) [DEP0107] DeprecationWarning: tls.convertNPNProtocols() is deprecated.
connected!
/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/node_modules/superfeedr/lib/superfeedr.js:190
  var subscribeStanza = new xmpp.Iq({to: SUPERFEEDR_ENDPOINT, id:id, type:'set', from: this.client.jid})
                        ^

TypeError: xmpp.Iq is not a constructor
    at Superfeedr.subscribe (/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/node_modules/superfeedr/lib/superfeedr.js:190:25)
    at Superfeedr.<anonymous> (/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/watcher.js:8:12)
    at Superfeedr.emit (events.js:198:13)
    at Client.<anonymous> (/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/node_modules/superfeedr/lib/superfeedr.js:19:10)
    at Client.emit (events.js:198:13)
    at Client.useFeatures (/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/node_modules/node-xmpp-client/lib/Client.js:365:10)
    at Client._handleSessionState (/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/node_modules/node-xmpp-client/lib/Client.js:261:10)
    at Client._handleStanza (/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/node_modules/node-xmpp-client/lib/Client.js:242:14)
    at Client.onStanza (/Users/jlynch/Git-Projects/Ameritrader-Bots/news-watcher/node_modules/node-xmpp-client/lib/Client.js:221:8)
    at Connection.emit (events.js:198:13)

Any thoughts on what I'm doing wrong here?

Thanks! ♥️

JimLynchCodes commented 4 years ago

Same error when I try running with node v11.15.0

JimLynchCodes commented 4 years ago

bump 🙃