Description :
I'm getting the following failure in the logs when calling the list-jira plugin. The logs, config output, package.json config and script source are include below.
Should the jira url be "https://demandforce.jira.com/login?"? Am I missing some node page in my json config?
Heroku Logs
2012-12-26T14:51:44+00:00 heroku[router]: at=info method=POST path=/hubot/ping host=intuit-hubot.herokuapp.com fwd=23.22.6.43 dyno=web.1 queue=0 wait=0ms connect=1ms service=4ms status=200 bytes=14
2012-12-26T15:11:44+00:00 app[web.1]: [Wed Dec 26 2012 15:11:44 GMT+0000 (UTC)] INFO keep alive ping!
2012-12-26T15:11:44+00:00 heroku[router]: at=info method=POST path=/hubot/ping host=intuit-hubot.herokuapp.com fwd=23.22.6.43 dyno=web.1 queue=0 wait=3ms connect=7ms service=12ms status=200 bytes=14
2012-12-26T15:31:44+00:00 app[web.1]: [Wed Dec 26 2012 15:31:44 GMT+0000 (UTC)] INFO keep alive ping!
2012-12-26T15:51:44+00:00 app[web.1]: [Wed Dec 26 2012 15:51:44 GMT+0000 (UTC)] INFO keep alive ping!
2012-12-26T16:03:40+00:00 app[web.1]: at TextListener.call (/app/node_modules/hubot/src/listener.coffee:19:14)
2012-12-26T16:03:40+00:00 app[web.1]: at Client.onRawStanza (/app/node_modules/hubot-hipchat/node_modules/wobot/node_modules/node-xmpp/lib/xmpp/client.js:159:14)
2012-12-26T16:03:40+00:00 app[web.1]: at HipChat.receive (/app/node_modules/hubot/src/adapter.coffee:37:25)
2012-12-26T16:03:40+00:00 app[web.1]: TypeError: Cannot call method 'split' of undefined
2012-12-26T16:03:40+00:00 app[web.1]: at Bot. (/app/node_modules/hubot-hipchat/src/hipchat.coffee:135:21)
2012-12-26T16:03:40+00:00 app[web.1]: at Bot.emit (events.js:70:17)
2012-12-26T16:03:40+00:00 app[web.1]: at Client.emit (events.js:67:17)
2012-12-26T16:03:40+00:00 app[web.1]: at Bot. (/app/node_modules/hubot-hipchat/node_modules/wobot/lib/bot.js:122:12)
2012-12-26T16:03:40+00:00 app[web.1]: at Robot.receive (/app/node_modules/hubot/src/robot.coffee:112:33)
2012-12-26T16:03:40+00:00 app[web.1]: at TextListener.callback (/app/scripts/list-jira-bugs.coffee:19:56)
2012-12-26T16:03:40+00:00 app[web.1]: [Wed Dec 26 2012 16:03:40 GMT+0000 (UTC)] ERROR Unable to call the listener: TypeError: Cannot call method 'split' of undefined
2012-12-26T16:03:40+00:00 app[web.1]: at Client. (native)
package.json
{
"name": "hosted-hubot",
"version": "2.3.2",
"author": "GitHub Inc.",
"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-hipchat": ">= 1.1.3",
"hubot": ">= 2.3.4",
"hubot-scripts": ">= 2.1.0",
"optparse": "1.0.3",
"htmlparser": "1.7.6",
"githubot": ">=0.1.5",
"jsdom": ">=0.2.14",
"underscore": "> 1.4.2",
"underscore.string": "> 2.3.0",
"soupselect": "0.2.0",
"redis": "0.7.2"
},
"engines": {
"node": "0.6.x",
"npm": "1.0.x"
}
}
list-jira-bugs.coffee
Description:
Get all bugs from JIRA assigned to user
Dependencies:
None
Configuration:
HUBOT_JIRA_DOMAIN
HUBOT_JIRA_USER
HUBOT_JIRA_PASSWORD
HUBOT_JIRA_ISSUE_TYPES
HUBOT_JIRA_ISSUE_PRIORITIES
Commands:
hubot list my bugs - Retrieve the list of all a user's bugs from JIRA ('my' is optional)
hubot list my bugs about - Retrieve list of all a user's bugs from JIRA where the summary or description field contains ('my' is optional)
hubot list my priority bugs - Retrieve the list of a user's priority bugs from JIRA ('my' is optional)
hubot list my priority bugs about - Retrieve list of all a user's priority bugs from JIRA where the summary or description field contains ('my' is optional)
Author:
crcastle
e.g. "bug|task|sub task|support ticket|new feature|epic"
issueTypes = process.env.HUBOT_JIRA_ISSUE_TYPES
issueTypes or= "bug|task|sub task|support ticket|new feature|epic" #some defaults
e.g. "blocker|high|medium|minor|trivial"
issuePriorities = process.env.HUBOT_JIRA_ISSUE_PRIORITIES
issuePriorities or= "blocker|high|medium|minor|trivial" #some defaults
/list( my)?( (blocker|high|medium|minor|trivial)( priority)?)? (bug|task|sub task|support ticket|new feature|epic|issue)s( about (.*))?/i
regexpString = "list( my)?( (" + issuePriorities + ")( priority)?)? (" + issueTypes + "|issue)s( about (.*))?"
regexp = new RegExp(regexpString, "i")
module.exports = (robot) ->
robot.respond regexp, (msg) ->
username = if msg.match[1] then msg.message.user.email.split('@')[0] else null
issueType = if msg.match[5] and msg.match[5] != "issue" then msg.match[5] else null
msg.send "Searching for issues..."
getIssues msg, issueType, username, msg.match[3], msg.match[6], (response) ->
msg.send response
getIssues = (msg, issueType, assignee, priority, phrase, callback) ->
username = process.env.HUBOT_JIRA_USER
password = process.env.HUBOT_JIRA_PASSWORD
domain = process.env.HUBOT_JIRA_DOMAIN
# do some error handling
unless username
msg.send "HUBOT_JIRA_USER environment variable must be set to a valid JIRA user's username."
return
unless password
msg.send "HUBOT_JIRA_PASSWORD environment variable must be set to a valid JIRA user's password."
return
unless domain
msg.send "HUBOT_JIRA_DOMAIN environment variables must be set to a valid <ORG>.jira.com domain."
return
jiraTypeList = toJiraTypeList(process.env.HUBOT_JIRA_ISSUE_TYPES.split('|'))
type = if issueType? then 'issueType="' + issueType + '"' else 'issueType in (' + jiraTypeList + ')'
user = if assignee? then ' and assignee="' + assignee + '"' else ''
prio = if priority? then ' and priority=' + priority else ''
search = if phrase? then ' and (summary~"' + phrase + '" or description~"' + phrase + '")' else ''
path = '/rest/api/latest/search'
url = "https://" + domain + path
queryString = type + ' and status!=closed' + user + prio + search
auth = "Basic " + new Buffer(username + ':' + password).toString('base64')
getJSON msg, url, queryString, auth, (err, json) ->
if err
msg.send "error getting issue list from JIRA"
return
if json.total? and (json.total==0 or json.total=="0")
msg.send "No issues like that, or you don't have access to see the issues."
issueList = []
for issue in json.issues
getJSON msg, issue.self, null, auth, (err, details) ->
if err
msg.send "error getting issue details from JIRA"
return
issueList.push( {key: details.key, summary: details.fields.summary.value} )
callback(formatIssueList(issueList, domain)) if issueList.length == json.issues.length
formatIssueList = (issueArray, domain) ->
formattedIssueList = ""
for issue in issueArray
formattedIssueList += issue.summary + " -> https://" + domain + "/browse/" + issue.key + "\n"
return formattedIssueList
getJSON = (msg, url, query, auth, callback) ->
msg.http(url)
.header('Authorization', auth)
.query(jql: query)
.get() (err, res, body) ->
callback( err, JSON.parse(body) )
toJiraTypeList = (arr) ->
newArr = []
for issueType in arr
newArr.push '"' + issueType + '"'
return newArr.join(',')
Heroku Vars
hubot Config Vars
HEROKU_URL: xxx
HUBOT_GOOGLE_SEARCH_KEY: xxx
HUBOT_HIPCHAT_JID: xxx
HUBOT_HIPCHAT_PASSWORD: xxx
HUBOT_JIRA_MAXLIST: xxx
HUBOT_JIRA_PASSWORD: xxx
HUBOT_JIRA_URL: https://demandforce.jira.com
HUBOT_JIRA_USER: xxx
PATH: bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin
REDISTOGO_URL: xxx