flowdock / hubot-flowdock

Flowdock adapter for Hubot chat bot
94 stars 60 forks source link

Hubot not responding to its own name #81

Open redterror opened 9 years ago

redterror commented 9 years ago

This is probably a dumb / basic issue, but I recently upgraded our hubot from 2.4.6 to 2.13.2 and the bot no longer responds to its name or to PMs. By "upgraded" I mean I simply mv'ed the old folder aside and did a fresh install with the same settings via a chef cookbook.

Several "when I hear" style plugins do work fine, and the debug output shows the bot is receiving content:

[Tue Jul 28 2015 21:08:34 GMT+0000 (UTC)] DEBUG Received message { event: 'message',
  tags: [ ':unread:115860' ],
  uuid: 'HC-AbEO08qnYpI2h',
  to: '115860',
  id: 8929106087,
  content: 'ping',
  sent: 1438117714366,
  app: 'chat',
  attachments: [],
  user: '31468' }
[Tue Jul 28 2015 21:08:37 GMT+0000 (UTC)] DEBUG Received message { event: 'message',
  tags: [ ':user:115860', ':unread:115860' ],
  uuid: 'Dkp76KV0_KBmxZMQ',
  to: '115860',
  id: 8929106127,
  content: '@hubot ping',
  sent: 1438117716835,
  app: 'chat',
  attachments: [],
  user: '31468' }
[Tue Jul 28 2015 21:08:40 GMT+0000 (UTC)] DEBUG Received message { event: 'message',
  tags: [ ':unread:115860' ],
  uuid: '1DMxtidrRh0Zfty2',
  to: '115860',
  id: 8929106185,
  content: 'hubot: ping',
  sent: 1438117720271,
  app: 'chat',
  attachments: [],
  user: '31468' }

The bot is started as:

hubot --name hubot --adapter flowdock

and our API token is set in the env.

Mumakil commented 9 years ago

Could you see if there are any relevant log lines when the bot starts? Also, which version of the adapter are you running?

redterror commented 9 years ago

I don't think any of these startup lines are relevant, but here's what I'm seeing:

[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Loading adapter flowdock
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] INFO Ignoring all messages from user ids 0
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Loading scripts from /opt/hubot/scripts
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Loading scripts from /opt/hubot/src/scripts
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Loading hubot-scripts from /opt/hubot/node_modules/hubot-scripts/src/scripts
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/ackbar.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/do-it-live.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/eight-ball.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/excuse.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/facepalm.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/homer.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/im.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/inigo-montoya.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/isup.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/kittens.coffee
[Wed Jul 29 2015 15:26:29 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/meme_generator.coffee
[Wed Jul 29 2015 15:26:30 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-scripts/src/scripts/xkcd.coffee
[Wed Jul 29 2015 15:26:30 GMT+0000 (UTC)] DEBUG Loading external-scripts from npm packages
[Wed Jul 29 2015 15:26:30 GMT+0000 (UTC)] DEBUG Parsing help for /opt/hubot/node_modules/hubot-fliptable/src/fliptable.coffee
[Wed Jul 29 2015 15:26:30 GMT+0000 (UTC)] INFO Found 3 flows, and I have joined 2 of them.
[Wed Jul 29 2015 15:26:30 GMT+0000 (UTC)] INFO Connecting to Flowdock as user hubot (id 115860).
[Wed Jul 29 2015 15:26:30 GMT+0000 (UTC)] INFO Flowdock: connecting
[Wed Jul 29 2015 15:26:31 GMT+0000 (UTC)] INFO Flowdock: connected and streaming
[Wed Jul 29 2015 15:26:31 GMT+0000 (UTC)] INFO Flowdock: listening to flows: XXXX, YYYYY

We're on adapter version 0.7.6.

Mumakil commented 9 years ago

Hmm, no clues there... There have been some problems when using an old npm (https://github.com/flowdock/hubot-flowdock/issues/76), and updating the npm itself has resolved the issue. We've however made changes to how the dependencies are loaded so that shouldn't be an issue anymore. Just out of curiosity, which version npm are you using?

I think the root cause was that there were two versions of the core hubot package installed, and the bot had a different version and the adapter had a different version. Some parts inside hubot are doing

Message = require('./message')

...

if message instanceof Message
  # react to message

which causes obvious problems when those packages were different.

redterror commented 9 years ago

Originally the box had an old npm (1.13.x), so I upgraded it to 2.13.2, but didn't see any change. On the topic of dependencies, I don't suppose there might be an issue with the package.json generated by my chef cookbook here:

{
  "name":        "chef-managed-hubot",
  "version":     "2.13.2",
  "author":      "GitHub Inc.",
  "private":     true,
  "keywords":    "github hubot campfire bot",
  "description": "A simple helpful Robot for your Company",
  "licenses":     [{
    "type":       "MIT",
    "url":        "http://github.com/github/hubot/raw/master/LICENSE"
  }],

  "repository" : {
    "type": "git",
    "url":  "https://github.com/github/hubot.git"
  },

  "dependencies": {
    "hubot": "2.13.2",
    "hubot-scripts": "2.16.1",
    "hubot-flowdock": ">= 0.6.0",
    "hubot-fliptable": ">= 0.0.0",
    "optparse": "1.0.3"
  },

  "engines": {
    "node": ">= 0.8.x",
    "npm": "1.1.x"
  }
}

PS - Hi Otto! Took me a few to realize why your avatar was so familiar.

Mumakil commented 9 years ago

Hi Dave =) I'm sorry but I don't see anything that might be wrong. I'll try to dig deeper tomorrow.

redterror commented 9 years ago

Thanks! Just curious, might it have anything to do with the display-name setting in the flowdock app? There the bot is set to 'hubot' (to match the name), but seeing as how this whole issue is related to name recognition I thought I'd ask all the same.

Mumakil commented 9 years ago

It should tell you in the log if the name does not match the one the bot thinks it's called. If the displayname is the same name than you give it on command line, it should be fine.

lockan commented 5 years ago

I'm not sure if this is the same issue or just something similar, but we're having issues with this as well, specifically when sending messages to the flowdock messages REST API endpoint.

Hubot responds to messages coming from flowdock chat when somebody sends "@hubotname some-message" through the chat UI. But if a message is sent to the flowdock messages REST API using an appropriate flow token for a room where the bot is present and includes "@hubotname" in the message parameter hubot does not respond. It will respond when posting to the private message api using hubot's user id, however.