-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hubot not compatible with versions >= 3.8.0 #19433
Comments
To replicate use the sample project from https://github.com/RocketChat/hubot-rocketchat-boilerplate but I can confirm that my previous setup was working fine until 3.8.0 |
It seems that the message passed to reactToMessages is now an array causing the issue I've managed to work around this by adding @rocket.chat\sdk\dist\lib\driver.js function respondToMessages(callback, options = {}) {
const config = Object.assign({}, respondDefaults(), options);
exports.lastReadTime = new Date(); // init before any message read
reactToMessages((err, message, meta) => __awaiter(this, void 0, void 0, function* () {
if (err) {
log_1.logger.error(`Unable to receive messages ${JSON.stringify(err)}`);
callback(err); // bubble errors back to adapter
}
// ****** ADDING THIS HERE RESOLVES THE ISSUE *****
message = message.slice(0,1).shift();
// Ignore bot's own messages
if (message.u._id === exports.userId)
return;
// Ignore DMs if configured to
const isDM = meta.roomType === 'd';
if (isDM && !config.dm)
return;
// Ignore Livechat if configured to
const isLC = meta.roomType === 'l';
if (isLC && !config.livechat)
return;
// Ignore messages in public rooms not joined by bot if configured to
if (!config.allPublic && !isDM && !meta.roomParticipant)
return;
// Set current time for comparison to incoming
let currentReadTime = new Date(message.ts.$date);
// Ignore edited messages if configured to
// unless it's newer than current read time (hasn't been seen before)
// @todo: test this logic, why not just return if edited and not responding
if (config.edited && typeof message.editedAt !== 'undefined') {
let edited = new Date(message.editedAt.$date);
if (edited > currentReadTime)
currentReadTime = edited;
}
// Ignore messages in stream that aren't new
if (currentReadTime <= exports.lastReadTime)
return;
// At this point, message has passed checks and can be responded to
log_1.logger.info(`Message receive callback ID ${message._id} at ${currentReadTime}`);
log_1.logger.info(`[Incoming] ${message.u.username}: ${(message.file !== undefined) ? message.attachments[0].title : message.msg}`);
exports.lastReadTime = currentReadTime;
// Add room name to meta, is useful for some adapters
if (!isDM && !isLC)
meta.roomName = yield getRoomName(message.rid);
// Processing completed, call callback to respond to message
callback(null, message, meta);
}));
}
exports.respondToMessages = respondToMessages; |
Tested against 3.8.0-rc.11 and issue still remains |
Tested against 3.8.0 release and its still the same. |
Can confirm issue(#19567)... impacts production systems of ours... |
Can confirm. |
It's broken in 3.9.0 too. |
+1 hubot isn't working on our 3.9.0 instance, relevant logs (from hubot docker):
|
some news about this error ? |
no, still broken with 3.9.1 |
its actually sort of a disaster, our bots (hubot, botkit) are not able to work properly since the server upgrade to 3.9.1 |
See RocketChat/Rocket.Chat.js.SDK#122 for workaround |
That is not even remotely a workaround if you don't know nothing about development inside RocketChat. I could not find the mentioned file so I can not fix this. Either somebody should write a better documentation for the workaround or much better just fix what was broken without further notice. |
Nobody should, but you could ask for help, that what internet is used sometimes :) I'm dealling with this right now, so if you have Ubuntu/Debian this should work:
|
Thanks for the comprehensive guide and sorry for my rude words before. Sometimes just asking is out of range when in rage too much. :) ☮️ |
@ggazzo I have a similar issue by upgrading from |
Description:
Since upgrading Rocket Chat from 3.7.1 to 3.8.0-rc.2 the integration between rocket chat and our hubot instance no longer works. Every time the bot receives a message the following exception is thrown ERROR TypeError: Cannot read property '_id' of undefined (see below).
I have replicated this by creating a new basic project with only the dependencies below and run the command hubot ping and will still get the below exception.
Steps to reproduce:
hubot ping
Expected behavior:
Receive response:
Pong
Actual behavior:
No response
Server Setup Information:
Client Setup Information
Additional context
From package.json
Relevant logs:
[Mon Nov 02 2020 11:05:05 GMT+0000 (Greenwich Mean Time)] ERROR TypeError: Cannot read property '_id' of undefined
at Object. (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\hubot-rocketchat\[email protected]\sdk\dist\lib\driver.js:374:23)
at Generator.next (:null:null)
at D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\hubot-rocketchat\[email protected]\sdk\dist\lib\driver.js:7:71
at new Promise (:null:null)
at __awaiter (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\hubot-rocketchat\[email protected]\sdk\dist\lib\driver.js:3:12)
at D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\hubot-rocketchat\[email protected]\sdk\dist\lib\driver.js:368:45
at ReactiveQuery. (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\hubot-rocketchat\[email protected]\sdk\dist\lib\driver.js:344:17)
at D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:170:12
at Array.forEach (:null:null)
at ReactiveQuery._emit (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:169:22)
at Set. (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:749:8)
at D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:170:12
at Array.forEach (:null:null)
at Set._emit (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:169:22)
at Set.put (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:965:7)
at Set. (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:1020:8)
at D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:170:12
at Array.forEach (:null:null)
at Set._emit (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:169:22)
at Set.put (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:965:7)
at Collection._remoteToLocalUpdate (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:695:12)
at Asteroid._onChanged (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:453:36)
at DDP. (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\asteroid\dist\asteroid.node.js:392:8)
at D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\ddp.js\src\ddp.js:125:12
at Array.forEach (:null:null)
at DDP._emit (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\ddp.js\src\ddp.js:124:22)
at DDP._on_changed (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\ddp.js\src\ddp.js:248:8)
at DDP._on_socket_message (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\ddp.js\src\ddp.js:326:26)
at Client.dispatchEvent (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\faye-websocket\lib\faye\websocket\api\event_target.js:24:30)
at Client._receiveMessage (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\faye-websocket\lib\faye\websocket\api.js:152:10)
at Client. (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\faye-websocket\lib\faye\websocket\api.js:36:49)
at Client.emit (node:events:339:22)
at Client. (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-driver\lib\websocket\driver\hybi.js:460:14)
at pipe (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-extensions\lib\pipeline\index.js:37:40)
at Pipeline._loop (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-extensions\lib\pipeline\index.js:44:3)
at Pipeline.processIncomingMessage (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-extensions\lib\pipeline\index.js:13:8)
at Extensions.processIncomingMessage (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-extensions\lib\websocket_extensions.js:133:20)
at Client._emitMessage (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-driver\lib\websocket\driver\hybi.js:451:22)
at Client._emitFrame (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-driver\lib\websocket\driver\hybi.js:411:19)
at Client.parse (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-driver\lib\websocket\driver\hybi.js:137:18)
at Client.parse (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-driver\lib\websocket\driver\client.js:63:58)
at IO.write (D:\ProgramData\SF2\vm0\Fabric\work\Applications\BotsType_App14\HubotPkg.Code.39.2.1-ci.18357\node_modules\websocket-driver\lib\websocket\streams.js:80:16)
at Socket.ondata (node:internal/streams/readable:715:22)
at Socket.emit (node:events:327:20)
at addChunk (node:internal/streams/readable:304:12)
at readableAddChunk (node:internal/streams/readable:279:9)
at Socket.Readable.push (node:internal/streams/readable:218:10)
at TCP.onStreamRead (node:internal/stream_base_commons:192:23)
The text was updated successfully, but these errors were encountered: