xmppjs / hubot-xmpp

XMPP adapter for Hubot
181 stars 103 forks source link

Error when using joining multiple chat rooms #110

Closed krutaw closed 7 years ago

krutaw commented 7 years ago

After updating to 0.2.3 to include the functionality mentioned in #104, I noticed that after enabling the "HUBOT_XMPP_UUID_ON_JOIN" environment variable (regardless of value - I tried both true and false), I receive the following error when adding hubot to multiple chatrooms:

[Mon Jul 25 2016 15:05:24 GMT-0400 (EDT)] ERROR TypeError: uuid.v4 is not a function
  at XmppBot.joinRoom (/usr/hubot/node_modules/hubot-xmpp/src/xmpp.coffee:151:19)
  at XmppBot.online (/usr/hubot/node_modules/hubot-xmpp/src/xmpp.coffee:111:6)
  at Client.<anonymous> (/usr/hubot/node_modules/hubot-xmpp/src/xmpp.coffee:1:1)
  at emitOne (events.js:90:13)
  at Client.emit (events.js:182:7)
  at Client.useFeatures (/usr/hubot/node_modules/node-xmpp-client/lib/Client.js:369:10)
  at Client._handleSessionState (/usr/hubot/node_modules/node-xmpp-client/lib/Client.js:262:10)
  at Client._handleStanza (/usr/hubot/node_modules/node-xmpp-client/lib/Client.js:243:14)
  at Client.onStanza (/usr/hubot/node_modules/node-xmpp-client/lib/Client.js:222:8)
  at emitOne (events.js:90:13)
  at Connection.emit (events.js:182:7)
  at Connection.onStanza (/usr/hubot/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:369:10)
  at StreamParser.<anonymous> (/usr/hubot/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:226:10)
  at emitOne (events.js:90:13)
  at StreamParser.emit (events.js:182:7)
  at SaxLtx.<anonymous> (/usr/hubot/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/StreamParser.js:58:14)
  at emitOne (events.js:90:13)
  at SaxLtx.emit (events.js:182:7)
  at SaxLtx._handleTagOpening (/usr/hubot/node_modules/ltx/lib/parsers/ltx.js:32:14)
  at SaxLtx.write (/usr/hubot/node_modules/ltx/lib/parsers/ltx.js:95:18)
  at StreamParser.write (/usr/hubot/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/StreamParser.js:123:17)
  at Connection.onData (/usr/hubot/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:305:17)
  at emitOne (events.js:95:20)
  at TLSSocket.emit (events.js:182:7)
  at readableAddChunk (_stream_readable.js:153:18)
  at TLSSocket.Readable.push (_stream_readable.js:111:10)
  at TLSWrap.onread (net.js:529:20)

After the error occurs, the hubot connection to Jabber is severed and the process of reconnecting starts (to the same result.) Commenting out the environment variable in my .env file did allow me to add Hubot to multiple chat rooms in the 0.2.3 version.

I should point out that a single chat room works without error.

markstory commented 7 years ago
[Mon Jul 25 2016 15:05:24 GMT-0400 (EDT)] ERROR TypeError: uuid.v4 is not a function

Seems like a key part of the problem. You'll need to re-install your dependencies.

krutaw commented 7 years ago

@markstory By that, I'm assuming you mean uuid, yes? So removing the UUID node_module, and then reinstalling it using 'npm install uuid'? I ask because indeed I had tried that and even went to the effort of testing to make sure that the uuid.v4() function was working by creating a simple coffeescript that looked like thus:

robot.hear /^get_uuid$/i, (msg) -> myuuid = uuid.v4() msg.send myuuid

This, of course, worked repeatedly. I think the concern here is that the error doesn't actually happen until adding a second chatroom to join and enabling the 'HUBOT_XMPP_UUID_ON_JOIN' variable.

Thoughts?

markstory commented 7 years ago

I see the mistake in the code now. I'll get that fixed.

markstory commented 7 years ago

0.2.4 tagged and published.

krutaw commented 7 years ago

@markstory NICE. Thanks again!