Hubot crashes with the error message: TypeError: Cannot read property 'toString' of undefined
The error is not in the adapters source code, but I believe the error is related to issue #388
TypeError: Cannot read property 'toString' of undefined
at new User (/usr/src/bot/node_modules/hubot/src/user.coffee:9:19,
at Brain.userForId (/usr/src/bot/node_modules/hubot/src/brain.coffee:106:7,
at SlackBot.userChange (/usr/src/bot/node_modules/hubot-slack/src/bot.coffee:233:5,
at RTMClient.
at RTMClient.emit (/usr/src/bot/node_modules/eventemitter3/index.js:116:35)
at RTMClient.emit (/usr/src/bot/node_modules/@slack/client/lib/clients/client.js:79:39)
at RTMClient._handleWsMessageViaEventHandler (/usr/src/bot/node_modules/@slack/client/lib/clients/rtm/client.js:465:10)
at RTMClient.handleWsMessage (/usr/src/bot/node_modules/@slack/client/lib/clients/rtm/client.js:419:10)
at WebSocket.wrapper (/usr/src/bot/node_modules/@slack/client/node_modules/lodash/lodash.js:4968:19)
at emitTwo (events.js:87:13)
at WebSocket.emit (events.js:172:7)
at Receiver.ontext (/usr/src/bot/node_modules/ws/lib/WebSocket.js:841:10)
at /usr/src/bot/node_modules/ws/lib/Receiver.js:536:18
at Receiver.applyExtensions (/usr/src/bot/node_modules/ws/lib/Receiver.js:371:5)
at /usr/src/bot/node_modules/ws/lib/Receiver.js:508:14
at Receiver.flush (/usr/src/bot/node_modules/ws/lib/Receiver.js:347:3)
at Receiver.opcodes.1.finish (/usr/src/bot/node_modules/ws/lib/Receiver.js:541:12)
at Receiver.expectHandler (/usr/src/bot/node_modules/ws/lib/Receiver.js:499:31)
at Receiver.add (/usr/src/bot/node_modules/ws/lib/Receiver.js:103:24)
at TLSSocket.realHandler (/usr/src/bot/node_modules/ws/lib/WebSocket.js:825:20)
at emitOne (events.js:77:13)
at TLSSocket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at TLSSocket.Readable.push (_stream_readable.js:110:10)
at TLSWrap.onread (net.js:523:20)
{project_name} version:
OS version(s): Ubuntu
Device(s):
N/A
N/A
N/A
N/A
I've also noticed this error recently. It looks like it's cropping up in the user_change event handler. Looks to be related to #381. Easily reproducible by editing my Slack profile.
Hubot-slack v4.3.1 running on Heroku.
Adding a console.log userproves what the docs say. The user object is inside the "user_change" object.
{ type: 'user_change',
user:
{ id: 'U0123ABCD',
team_id: 'T0123ABCD',
name: 'will',
... },
... }
This issue is also repro in MacOs ElCapitan 10.11.6
โโโฌ [email protected]
โ โโโฌ @slack/[email protected]
โ โ โโโ [email protected]
โ โ โโโ [email protected]
โ โ โโโ [email protected]
โ โ โโโ [email protected]
โ โ โโโ [email protected]
โ โ โโโ UNMET DEPENDENCY slack@^8.1.2
โ โ โโโ [email protected]
โ โ โโโฌ [email protected]
โ โ โ โโโ [email protected]
โ โ โ โโโ [email protected]
โ โ โ โโโ [email protected]
โ โ โ โโโ [email protected]
โ โ โ โโโ [email protected]
โ โ โโโฌ [email protected]
โ โ โโโ [email protected]
โ โ โโโ [email protected]
โ โโโ [email protected]
I just wanted folks to know that we've seen a number of issues stemming from this in the wild, so I've raised the priority level. I plan to address this with either the generously contributed PR from @pearswj or something myself and make a release next week.
hi folks! ive got a fix for this issue in #399. @pearswj thanks for your contribution, but IMHO the changes you made were a little larger than necessary to fix the issue and we prefer a smaller change, so i'll be closing that after i merge this.
@aoberoi No worries. Thanks for the feedback.
Is there a workaround for this by chance?
@zero1zero The fix (see #399) was _just_ released in v4.3.2 ๐
Thanks for the fix.
Most helpful comment
I just wanted folks to know that we've seen a number of issues stemming from this in the wild, so I've raised the priority level. I plan to address this with either the generously contributed PR from @pearswj or something myself and make a release next week.