TypeError: Cannot read property 'token' of undefined
I'm getting this error on Heroku for each chat message:
TypeError: Cannot read property 'token' of undefined
The offending line is https://github.com/tinyspeck/hubot-slack/blob/master/src/slack.coffee#L161
Could it be an issue with the scoping of this?
Here is a full backtrace:
2014-09-02T20:32:57.663339+00:00 app[web.1]: Slack adapter options: { token: '[REDACTED]',
2014-09-02T20:32:57.663357+00:00 app[web.1]: name: 'actionbot',
2014-09-02T20:32:57.663358+00:00 app[web.1]: mode: 'blacklist',
2014-09-02T20:32:57.663356+00:00 app[web.1]: team: 'actionsprout',
2014-09-02T20:32:57.663361+00:00 app[web.1]: link_names: 0 }
2014-09-02T20:32:57.663360+00:00 app[web.1]: channels: [ 'development', 'general', 'random' ],
2014-09-02T20:32:57.664619+00:00 app[web.1]: Successfully 'connected' as actionbot
2014-09-02T20:44:39.176747+00:00 heroku[router]: at=info method=POST path="/hubot/slack-webhook" host=actionsprout-slackbot.herokuapp.com request_id=134eaf43-0b20-4b31-8d76-525b653a1ab8 fwd="54.91.174.134" dyno=web.1 connect=4ms service=6ms status=500 bytes=711
2014-09-02T20:44:39.171453+00:00 app[web.1]: Incoming message received
2014-09-02T20:44:39.172026+00:00 app[web.1]: TypeError: Cannot read property 'token' of undefined
2014-09-02T20:44:39.172029+00:00 app[web.1]: at /app/node_modules/hubot-slack/src/slack.coffee:161:7, <js>:165:47
2014-09-02T20:44:39.172031+00:00 app[web.1]: at callbacks (/app/node_modules/hubot/node_modules/express/lib/router/index.js:161:37)
2014-09-02T20:44:39.172032+00:00 app[web.1]: at param (/app/node_modules/hubot/node_modules/express/lib/router/index.js:135:11)
2014-09-02T20:44:39.172034+00:00 app[web.1]: at pass (/app/node_modules/hubot/node_modules/express/lib/router/index.js:142:5)
2014-09-02T20:44:39.172035+00:00 app[web.1]: at Router._dispatch (/app/node_modules/hubot/node_modules/express/lib/router/index.js:170:5)
2014-09-02T20:44:39.172037+00:00 app[web.1]: at Object.router (/app/node_modules/hubot/node_modules/express/lib/router/index.js:33:10)
2014-09-02T20:44:39.172038+00:00 app[web.1]: at next (/app/node_modules/hubot/node_modules/express/node_modules/connect/lib/proto.js:190:15)
2014-09-02T20:44:39.172040+00:00 app[web.1]: at multipart (/app/node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/multipart.js:60:27)
2014-09-02T20:44:39.172041+00:00 app[web.1]: at /app/node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:57:9
2014-09-02T20:44:39.172043+00:00 app[web.1]: at IncomingMessage.<anonymous> (/app/node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js:70:11)
2014-09-02T20:44:39.172045+00:00 app[web.1]: at IncomingMessage.emit (events.js:92:17)
2014-09-02T20:44:39.172046+00:00 app[web.1]: at _stream_readable.js:943:16
2014-09-02T20:44:39.172048+00:00 app[web.1]: at process._tickCallback (node.js:419:13)
2014-09-02T20:44:39.172049+00:00 app[web.1]:
NOTE: This occurs with 2.1.2 but not 2.1.1.
Very sorry. Just pushed 2.1.3 with a fix.
@grantmd thanks!
I'm not seeing an error now, but I'm also not getting a response (just like #68). Any ideas?
Same issue here (with 2.1.3) no error and no response like #68.
2.2.0 fixes all of this, along with tests to make sure I don't mess it up again.
Works like a charm with 2.2.0.
Thanks a lot!
Yay, thanks! 2.2.0 works great