ndaversa / hubot-jira-bot

Lets you search for JIRA tickets, open them, transition them thru different states, comment on them, rank them up or down, start or stop watching them or change who is assigned to a ticket. Also, notifications for assignments, mentions and watched tickets.
https://www.npmjs.com/package/hubot-jira-bot
MIT License
61 stars 43 forks source link

Support latest hubot-slack adapter #20

Closed mrbase closed 7 years ago

mrbase commented 8 years ago

When running hubot jira help, I get the following error:

ERROR TypeError: this.robot.adapter.customMessage is not a function

I have tried to update npm and reinstalled this plugin, but no luck.

Any help or pointers welcome :)

ndaversa commented 8 years ago

@mrbase it might be an oversight, I presume you are NOT running with a slack adapter?

mrbase commented 8 years ago

I'm running it as this:

[env vars] node_modules/.bin/hubot --name "bangbot" --adapter slack --alias "!"

Startup output with debug enabled is (date stuff removed):

DEBUG Loading adapter slack
INFO Logged in as hubot of xxxx
INFO Slack client now connected
DEBUG Loading scripts from /var/www/hubot-test/techops-jira/scripts
DEBUG Parsing help for /var/www/hubot-test/techops-jira/scripts/example.coffee
DEBUG Loading scripts from /var/www/hubot-test/techops-jira/src/scripts
DEBUG Loading external-scripts from npm packages
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-diagnostics/src/diagnostics.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-help/src/help.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-google-images/src/google-images.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-google-translate/src/google-translate.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-pugme/src/pugme.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-maps/src/maps.coffee
INFO hubot-redis-brain: Using default redis on localhost:6379
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-redis-brain/src/redis-brain.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-rules/src/rules.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-shipit/src/shipit.coffee
DEBUG Parsing help for /var/www/hubot-test/techops-jira/node_modules/hubot-jira-bot/src/index.coffee
DEBUG hubot-redis-brain: Successfully connected to Redis
INFO hubot-redis-brain: Data for hubot brain retrieved from Redis
DEBUG Received message: '!jira help' in channel: webhooktest, from: un
DEBUG Message '!jira help' matched regex //^\s*[@]?(?:hubot[:,]?|![:,]?)\s*(?:(?:help jira|jira help)(?: (.*))?)//; listener.options = { id: null }
DEBUG Executing listener callback for Message '!jira help'
ERROR TypeError: this.robot.adapter.customMessage is not a function
  at Slack.send (/var/www/hubot-test/techops-jira/node_modules/hubot-jira-bot/src/adapters/slack.coffee:40:25)
  at JiraBot.send (/var/www/hubot-test/techops-jira/node_modules/hubot-jira-bot/src/index.coffee:50:14)
  at TextListener.callback (/var/www/hubot-test/techops-jira/node_modules/hubot-jira-bot/src/index.coffee:330:8)
  at /var/www/hubot-test/techops-jira/node_modules/hubot/src/listener.coffee:65:12
  at allDone (/var/www/hubot-test/techops-jira/node_modules/hubot/src/middleware.coffee:44:37)
  at /var/www/hubot-test/techops-jira/node_modules/async/lib/async.js:274:13
  at Object.async.eachSeries (/var/www/hubot-test/techops-jira/node_modules/async/lib/async.js:142:20)
  at Object.async.reduce (/var/www/hubot-test/techops-jira/node_modules/async/lib/async.js:268:15)
  at /var/www/hubot-test/techops-jira/node_modules/hubot/src/middleware.coffee:49:13
  at _combinedTickCallback (node.js:376:9)
  at process._tickCallback (node.js:407:11)

My packages.json looks like this:

{
  "name": "techops-jira",
  "version": "0.0.0",
  "private": true,
  "author": "ulrik nielsen <me@ulrik.co>",
  "description": "JIRA integration for techops team",
  "dependencies": {
    "hubot": "^2.19.0",
    "hubot-diagnostics": "0.0.1",
    "hubot-google-images": "^0.2.6",
    "hubot-google-translate": "^0.2.0",
    "hubot-help": "^0.2.0",
    "hubot-jira-bot": "^6.10.5",
    "hubot-maps": "0.0.2",
    "hubot-pugme": "^0.1.0",
    "hubot-redis-brain": "0.0.3",
    "hubot-rules": "^0.1.1",
    "hubot-scripts": "^2.17.2",
    "hubot-shipit": "^0.2.0",
    "hubot-slack": "^4.0.2"
  },
  "engines": {
    "node": "0.10.x"
  }
}

I can see that the bot registeres in slack, and I can sort of talk back to hubot - the PING/PONG command works.

ndaversa commented 8 years ago

@mrbase do you have all the envvars set?

https://github.com/ndaversa/hubot-jira-bot/blob/master/src/config.coffee#L2-14

mrbase commented 8 years ago

I have these:

ADAPTER=slack
HUBOT_USER=hubot
HUBOT_NAME=bangbot
HUBOT_ALIAS=!
HUBOT_LOG_LEVEL=debug
HUBOT_SLACK_TOKEN=xoxb-xxxxxxx
HUBOT_SLACK_VERIFICATION_TOKEN=xoxb-xxxxxxx
HUBOT_SLACK_BUTTONS={"watch":{"name":"watch","text":"Watch","type":"button","value":"watch","style":"primary"},"assign":{"name":"assign","text":"Assign to me","type":"button","value":"assign"},"devready":{"name":"devready","text":"Dev Ready","type":"button","value":"selected"},"inprogress":{"name":"inprogress","text":"In Progress","type":"button","value":"progress"},"rank":{"name":"rank","text":"Rank Top","type":"button","value":"top"},"running":{"name":"running","text":"Running","type":"button","value":"running"},"review":{"name":"review","text":"Review","type":"button","value":"review"},"resolved":{"name":"resolved","text":"Resolved","type":"button","style":"primary","value":"resolved"},"done":{"name":"done","text":"Done","type":"button","style":"primary","value":"done"}}
HUBOT_SLACK_PROJECT_BUTTON_STATE_MAP={"PLAT":{"inprogress":["review","running","resolved"],"review":["running","resolved"],"running":["resolved"],"resolved":["devready","inprogress"],"mention":["watch","assign","devready","inprogress","rank"]},"HAL":{"inprogress":["review","running","resolved"],"review":["running","resolved"],"running":["resolved"],"resolved":["devready","inprogress"],"mention":["watch","assign","devready","inprogress","rank"]},"default":{"inprogress":["review","done"],"review":["done"],"done":["devready, inprogress"],"mention":["watch","assign","devready","inprogress","rank"]}}
HUBOT_JIRA_GITHUB_DISABLED=true
HUBOT_JIRA_URL=https://.......com
HUBOT_JIRA_USERNAME=yyyyyyyyyyy
HUBOT_JIRA_PASSWORD=xxxxxxxxxxxx
HUBOT_JIRA_DEFAULT_PROJECT=SIO
HUBOT_JIRA_PRIORITIES_MAP=[{"name":"Blocker","id":"1"},{"name":"Critical","id":"2"},{"name":"Major","id":"3"},{"name":"Minor","id":"4"},{"name":"Trivial","id":"5"}]
HUBOT_JIRA_PROJECTS_MAP={"sio":"SIO","uc":"UC"}
HUBOT_JIRA_TRANSITIONS_MAP=[{"name":"triage","jira":"Triage"},{"name":"icebox","jira":"Icebox"},{"name":"backlog","jira":"Backlog"},{"name":"devready","jira":"Selected for Development"},{"name":"inprogress","jira":"In Progress"},{"name":"design","jira":"Design Triage"}]
HUBOT_JIRA_TYPES_MAP={"story":"Story / Feature","bug":"Bug","task":"Task"}
HUBOT_GITHUB_ORG=xxx
HUBOT_GITHUB_TOKEN=yyy

My external-scripts.json looks like this:

[
  "hubot-diagnostics",
  "hubot-help",
  "hubot-google-images",
  "hubot-google-translate",
  "hubot-pugme",
  "hubot-maps",
  "hubot-redis-brain",
  "hubot-rules",
  "hubot-shipit",
  "hubot-jira-bot"
]
kruczjak commented 8 years ago

Same happened for me after updating to hubot-slack v4.0.2

Looks like they've removed customMessage... https://github.com/slackhq/hubot-slack/issues/342#issuecomment-242292532

mrbase commented 8 years ago

Yeah, apparently you have to use this instead: https://github.com/slackhq/hubot-slack/pull/314

ndaversa commented 8 years ago

@kruczjak @mrbase I'll need to do some work to support the latest hubot-slack. In the mean time I recommend the earlier version if you want to continue using hubot-jira-bot

ndaversa commented 7 years ago

@mrbase the latest version now supports the latest hubot-slack adapter

mrbase commented 7 years ago

Cool, will have a look 👍