LeanKit / leankit-node-client

LeanKit client for Node.js
MIT License
16 stars 8 forks source link

ERROR TypeError: Cannot set property 'UserWipOverrideComment' of undefined #2

Closed adam-stokes closed 10 years ago

adam-stokes commented 10 years ago

Attempting to use the addCard api and receiving the following traceback:

[Tue Aug 12 2014 22:16:55 GMT-0400 (EDT)] ERROR TypeError: Cannot set property 'UserWipOverrideComment' of undefined
  at LeanKitClient.exports.LeanKitClient.LeanKitClient.addCardWithWipOverride (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/leankit-client.js:149:35)
  at LeanKitClient.exports.LeanKitClient.LeanKitClient.addCard (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/leankit-client.js:145:19)
  at /home/adam/Projects/hubot-leankit/scripts/leankit.coffee:54:9, <js>:43:25
  at parseReplyData (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/leankit-client.js:18:14)
  at /home/adam/Projects/hubot-leankit/node_modules/leankit-client/leankit-client.js:61:16
  at parseBody (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/node_modules/request-json/main.js:26:12)
  at Request._callback (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/node_modules/request-json/main.js:68:18)
  at Request.self.callback (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/node_modules/request-json/node_modules/request/index.js:148:22)
  at Request.emit (events.js:98:17)
  at Request.<anonymous> (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/node_modules/request-json/node_modules/request/index.js:876:14)
  at Request.emit (events.js:117:20)
  at IncomingMessage.<anonymous> (/home/adam/Projects/hubot-leankit/node_modules/leankit-client/node_modules/request-json/node_modules/request/index.js:827:12)
  at IncomingMessage.emit (events.js:117:20)
  at _stream_readable.js:938:16
  at process._tickCallback (node.js:419:13)
  robot.respond /lk add (\d+) (.*)/i, (msg) ->
    user = msg.message.user
    boardId = msg.match[1]
    title = msg.match[2]
    board = robot.brain.data.lkboards[boardId]
    client.getBoardByName board, (err, b) ->
      if b?
        now = new Date()
        cardType = _.find(b.CardTypes, 'IsDefault': true)
        lane = _.find(b.Lanes, 'IsDefaultDropLane': true)
        newCard = {}
        newCard.TypeId = cardType.Id
        newCard.Title = title
        newCard.ExternalCardId = now.getTime()
        newCard.LaneId = lane.Id
        newCard.Position = 0
        client.addCard b.Id, newCard, (err, res) ->
          if res?
            msg.send "Added card(#{res.CardId}): #{title} to " +
                     "#{board.Title}/#{lane.title}."
      else
        msg.send "Unable to add card to Board"

I looked a bit at the client code and that variable does seem to be set.