RocketChat / hubot-rocketchat

Rocket.Chat Hubot adapter
MIT License
580 stars 229 forks source link

ERROR TypeError: Cannot read property '_id' of undefined #338

Open rmountjoy92 opened 4 years ago

rmountjoy92 commented 4 years ago

Hello, I recently updated to rocket chat version 3.8 and hubot has stopped working. Here is my logs:

npm info postinstall hubot-pugme@0.1.1

npm info postinstall hubot-google-translate@0.2.1

npm info install hubot-diagnostics@0.0.2

npm info postinstall hubot-diagnostics@0.0.2

hubot-maps@0.0.3 node_modules/hubot-maps

hubot-help@0.2.2 node_modules/hubot-help

hubot-shipit@0.2.1 node_modules/hubot-shipit

hubot-google-images@0.2.7 node_modules/hubot-google-images

hubot-rules@0.1.2 node_modules/hubot-rules

hubot-pugme@0.1.1 node_modules/hubot-pugme

hubot-google-translate@0.2.1 node_modules/hubot-google-translate

hubot-diagnostics@0.0.2 node_modules/hubot-diagnostics

npm info ok 

npm info it worked if it ends with ok

m info using npm@2.15.11

m info using node@v4.8.3

npm info preinstall rocketbot@0.0.0

npm info package.json hubot-scripts@2.17.2 No license field.

m info build /home/hubot

npm info linkStuff rocketbot@0.0.0

npm info build /home/hubot/node_modules/hubot-rocketchat

npm info preinstall hubot-rocketchat@1.0.11

npm info linkStuff hubot-rocketchat@1.0.11

npm info install hubot-rocketchat@1.0.11

npm info postinstall hubot-rocketchat@1.0.11

npm info install rocketbot@0.0.0

npm info postinstall rocketbot@0.0.0

npm info prepublish rocketbot@0.0.0


npm info ok 

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Starting Rocketchat adapter version 1.0.11...

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Once connected to rooms I will respond to the name: hera

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] WARNING No services ROCKETCHAT_ROOM provided to Hubot, using 

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Connecting To: mychatserver.com:443

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Successfully connected!

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO 

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Logging In

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Successfully Logged In

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO rid:  []

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO All rooms joined.

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Preparing Meteor Subscriptions..

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Subscribing to Room: __my_messages__

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Successfully subscribed to messages

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] INFO Setting up reactive message list...

[Tue Nov 17 2020 15:09:42 GMT+0000 (UTC)] WARNING Loading scripts from hubot-scripts.json is deprecated and will be removed in 3.0 (https://github.com/github/hubot-scripts/issues/1113) in favor of packages for each script.

Your hubot-scripts.json is empty, so you just need to remove it.

[Tue Nov 17 2020 15:10:01 GMT+0000 (UTC)] INFO Message received with ID id

[Tue Nov 17 2020 15:10:01 GMT+0000 (UTC)] ERROR TypeError: Cannot read property '_id' of undefined

    at /home/hubot/node_modules/hubot-rocketchat/src/rocketchat.js:193:27

    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/src/rocketchat_driver.js:231:22)

    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:170:12

    at Array.forEach (native)

    at [object Object].Asteroid.utils.EventEmitter._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:169:22)

    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:749:8)

    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:170:12

    at Array.forEach (native)

    at [object Object].Asteroid.utils.EventEmitter._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:169:22)

    at [object Object].Set.put (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:965:7)

    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:1020:8)

    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:170:12

    at Array.forEach (native)

    at [object Object].Asteroid.utils.EventEmitter._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:169:22)

    at [object Object].Set.put (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:965:7)

    at [object Object].Collection._remoteToLocalUpdate (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:695:12)

    at [object Object].Asteroid._onChanged (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:453:36)

    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:392:8)

    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:125:12

    at Array.forEach (native)

    at [object Object].DDP._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:124:22)

    at [object Object].DDP._on_changed (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:248:8)

    at [object Object].DDP._on_socket_message (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:326:26)

    at [object Object].EventTarget.dispatchEvent (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:22:30)

    at [object Object].instance._receiveMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/lib/faye/websocket/api.js:150:10)

    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/lib/faye/websocket/api.js:34:49)

    at emitOne (events.js:82:20)

    at [object Object].emit (events.js:169:7)

    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:451:14)

    at pipe (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:37:40)

    at [object Object].Pipeline._loop (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:44:3)

    at [object Object].Pipeline.processIncomingMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:13:8)

    at [object Object].instance.processIncomingMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/websocket_extensions.js:133:20)

    at [object Object].instance._emitMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:442:22)

    at [object Object].instance._emitFrame (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:405:19)

    at [object Object].instance.parse (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:141:18)

    at [object Object].instance.parse (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/client.js:62:58)

    at [object Object].IO.write (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/streams.js:80:16)

    at TLSSocket.ondata (_stream_readable.js:542:20)

    at emitOne (events.js:77:13)

    at TLSSocket.emit (events.js:169:7)

    at readableAddChunk (_stream_readable.js:153:18)

    at TLSSocket.Readable.push (_stream_readable.js:111:10)

    at TLSWrap.onread (net.js:540:20)
sschueller commented 4 years ago

I am having the same issue after upgrade to Rocketchat server 3.8.0. The dockerfile in the master also doesn't compile:

/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/lib/cli.js
/usr/local/bin/yo-complete -> /usr/local/lib/node_modules/yo/lib/completion/index.js
npm info install yo@3.1.1
npm info postinstall yo@3.1.1

> yo@3.1.1 postinstall /usr/local/lib/node_modules/yo
> yodoctor

/usr/local/lib/node_modules/yo/node_modules/yeoman-doctor/lib/index.js:12
  (async () => {
         ^

SyntaxError: Unexpected token (
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/yeoman-doctor/lib/cli.js:3:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
npm info yo@3.1.1 Failed to exec postinstall script
npm ERR! Linux 4.9.0-9-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-script" "yo" "generator-hubot"
npm ERR! node v4.8.3
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE

npm ERR! yo@3.1.1 postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yo@3.1.1 postinstall script 'yodoctor'.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     yodoctor
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs yo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.
npm info preuninstall yo@3.1.1
npm info uninstall yo@3.1.1
npm info postuninstall yo@3.1.1

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log
The command '/bin/sh -c npm install -g coffee-script yo generator-hubot  &&     useradd hubot -m' returned a non-zero code: 1
Opa- commented 4 years ago

Reporting the same issue here with Rocket.Chat 3.8.1 and docker image rocketchat/hubot-rocketchat:v1.0.11

[Mon Nov 23 2020 18:39:39 GMT+0000 (UTC)] INFO Message received with ID id
[Mon Nov 23 2020 18:39:39 GMT+0000 (UTC)] ERROR TypeError: Cannot read property '_id' of undefined
    at /home/hubot/node_modules/hubot-rocketchat/src/rocketchat.js:193:27
    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/src/rocketchat_driver.js:231:22)
    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (native)
    at [object Object].Asteroid.utils.EventEmitter._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:749:8)
    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (native)
    at [object Object].Asteroid.utils.EventEmitter._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at [object Object].Set.put (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:965:7)
    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:1020:8)
    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (native)
    at [object Object].Asteroid.utils.EventEmitter._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at [object Object].Set.put (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:965:7)
    at [object Object].Collection._remoteToLocalUpdate (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:695:12)
    at [object Object].Asteroid._onChanged (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:453:36)
    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/dist/asteroid.node.js:392:8)
    at /home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:125:12
    at Array.forEach (native)
    at [object Object].DDP._emit (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:124:22)
    at [object Object].DDP._on_changed (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:248:8)
    at [object Object].DDP._on_socket_message (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/ddp.js/src/ddp.js:326:26)
    at [object Object].EventTarget.dispatchEvent (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:22:30)
    at [object Object].instance._receiveMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/lib/faye/websocket/api.js:150:10)
    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/lib/faye/websocket/api.js:34:49)
    at emitOne (events.js:82:20)
    at [object Object].emit (events.js:169:7)
    at [object Object].<anonymous> (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:451:14)
    at pipe (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:37:40)
    at [object Object].Pipeline._loop (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:44:3)
    at [object Object].Pipeline.processIncomingMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:13:8)
    at [object Object].instance.processIncomingMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/websocket_extensions.js:133:20)
    at [object Object].instance._emitMessage (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:442:22)
    at [object Object].instance._emitFrame (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:405:19)
    at [object Object].instance.parse (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:141:18)
    at [object Object].instance.parse (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/client.js:62:58)
    at [object Object].IO.write (/home/hubot/node_modules/hubot-rocketchat/node_modules/asteroid/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/streams.js:80:16)
    at TLSSocket.ondata (_stream_readable.js:542:20)
    at emitOne (events.js:77:13)
    at TLSSocket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at TLSSocket.Readable.push (_stream_readable.js:111:10)
    at TLSWrap.onread (net.js:540:20)
Opa- commented 4 years ago

So it appears that the variable newmsg -> https://github.com/RocketChat/hubot-rocketchat/blob/v1.0.11/src/rocketchat.coffee#L137 is now an array.

Replacing all occurrences of newmsg. with newmsg[0]. did the trick but I'm not sure what the root cause of this so I'll let someone more familiar with Rocket.Chat and hubot do the modifications 😉

sschueller commented 3 years ago

This fork https://github.com/DeviaVir/hubot-rocketchat uses a patched version of @rocket.chat/sdk that fixes the _id issue. To use it I use the following Dockerfile.

FROM node:14.15.1
MAINTAINER Rocket.Chat Team <buildmaster@rocket.chat>

RUN npm install -g coffeescript -g yo generator-hubot  &&  \
    useradd hubot -m

USER hubot

WORKDIR /home/hubot

ENV BOT_NAME "rocketbot"
ENV BOT_OWNER "No owner specified"
ENV BOT_DESC "Hubot with rocketbot adapter"

#ENV EXTERNAL_SCRIPTS=

RUN cd /home/hubot

RUN yo hubot --owner="$BOT_OWNER" --name="$BOT_NAME" --description="$BOT_DESC" --defaults && \
    sed -i /heroku/d ./external-scripts.json && \
    sed -i /redis-brain/d ./external-scripts.json && \
    npm install hubot-scripts && npm install git+https://github.com/DeviaVir/hubot-rocketchat.git

COPY bots /home/hubot/scripts # copy bots into docker image, alternativly mount them into the conainer

CMD bin/hubot -n $BOT_NAME -a rocketchat
im-perativa commented 3 years ago

Having same issue with Rocket.Chat 3.8.1 after following this tutorial

[Thu Nov 26 2020 17:50:19 GMT+0700 (Western Indonesia Time)] INFO [connect] Connected
[Thu Nov 26 2020 17:50:19 GMT+0700 (Western Indonesia Time)] INFO [login] Logging in halobot
[Thu Nov 26 2020 17:50:19 GMT+0700 (Western Indonesia Time)] INFO [subscribe] Preparing subscription: stream-room-messages: __my_messages__
[Thu Nov 26 2020 17:50:19 GMT+0700 (Western Indonesia Time)] INFO [subscribe] Stream ready: 2
[Thu Nov 26 2020 17:50:19 GMT+0700 (Western Indonesia Time)] INFO [reactive] Listening for change events in collection stream-room-messages
[Thu Nov 26 2020 17:50:41 GMT+0700 (Western Indonesia Time)] INFO [received] Message in room undefined
(node:26077) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '_id' of undefined
    at Object.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:357:23)
    at Generator.next (<anonymous>:null:null)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:7:71
    at new Promise (<anonymous>:null:null)
    at __awaiter (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:3:12)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:351:45
    at ReactiveQuery.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:314:17)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (<anonymous>:null:null)
    at ReactiveQuery._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at Set.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:749:8)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (<anonymous>:null:null)
    at Set._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at Set.put (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:965:7)
    at Set.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:1020:8)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (<anonymous>:null:null)
    at Set._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at Set.put (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:965:7)
    at Collection._remoteToLocalUpdate (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:695:12)
    at Asteroid._onChanged (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:453:36)
    at DDP.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:392:8)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:125:12
    at Array.forEach (<anonymous>:null:null)
    at DDP._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:124:22)
    at DDP._on_changed (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:248:8)
    at DDP._on_socket_message (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:326:26)
    at Client.dispatchEvent (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:24:30)
    at Client._receiveMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/faye-websocket/lib/faye/websocket/api.js:152:10)
    at Client.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/faye-websocket/lib/faye/websocket/api.js:36:49)
    at Client.emit (events.js:333:22)
    at Client.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:460:14)
    at pipe (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/pipeline/index.js:37:40)
    at Pipeline._loop (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/pipeline/index.js:44:3)
    at Pipeline.processIncomingMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/pipeline/index.js:13:8)
    at Extensions.processIncomingMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/websocket_extensions.js:133:20)
    at Client._emitMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:451:22)
    at Client._emitFrame (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:411:19)
    at Client.parse (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:137:18)
    at Client.parse (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/client.js:63:58)
    at IO.write (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/streams.js:80:16)
    at TLSSocket.ondata (_stream_readable.js:708:22)
    at TLSSocket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at TLSSocket.Readable.push (_stream_readable.js:214:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)

(node:26077) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26077) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Thu Nov 26 2020 17:50:41 GMT+0700 (Western Indonesia Time)] INFO [received] Message in room undefined
(node:26077) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '_id' of undefined
    at Object.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:357:23)
    at Generator.next (<anonymous>:null:null)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:7:71
    at new Promise (<anonymous>:null:null)
    at __awaiter (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:3:12)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:351:45
    at ReactiveQuery.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/@rocket.chat/sdk/dist/lib/driver.js:314:17)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (<anonymous>:null:null)
    at ReactiveQuery._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at Set.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:749:8)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (<anonymous>:null:null)
    at Set._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at Set.put (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:965:7)
    at Set.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:1020:8)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:170:12
    at Array.forEach (<anonymous>:null:null)
    at Set._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:169:22)
    at Set.put (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:965:7)
    at Collection._remoteToLocalUpdate (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:695:12)
    at Asteroid._onChanged (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:453:36)
    at DDP.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/asteroid/dist/asteroid.node.js:392:8)
    at /var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:125:12
    at Array.forEach (<anonymous>:null:null)
    at DDP._emit (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:124:22)
    at DDP._on_changed (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:248:8)
    at DDP._on_socket_message (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/ddp.js/src/ddp.js:326:26)
    at Client.dispatchEvent (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:24:30)
    at Client._receiveMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/faye-websocket/lib/faye/websocket/api.js:152:10)
    at Client.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/faye-websocket/lib/faye/websocket/api.js:36:49)
    at Client.emit (events.js:333:22)
    at Client.<anonymous> (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:460:14)
    at pipe (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/pipeline/index.js:37:40)
    at Pipeline._loop (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/pipeline/index.js:44:3)
    at Pipeline.processIncomingMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/pipeline/index.js:13:8)
    at Extensions.processIncomingMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-extensions/lib/websocket_extensions.js:133:20)
    at Client._emitMessage (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:451:22)
    at Client._emitFrame (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:411:19)
    at Client.parse (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/hybi.js:137:18)
    at Client.parse (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/driver/client.js:63:58)
    at IO.write (/var/www/halo.stis.ac.id/bots/hubot-rocketchat-boilerplate/node_modules/websocket-driver/lib/websocket/streams.js:80:16)
    at TLSSocket.ondata (_stream_readable.js:708:22)
    at TLSSocket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at TLSSocket.Readable.push (_stream_readable.js:214:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)

(node:26077) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
osallou commented 3 years ago

@imperativa28 as said above in thread, message is now an array.. :-( Don t know why either.

In driver.js, respondToMessage function in node_modules/@rocket.chat/sdk/dist/lib/driver.js around line 357 you just have to add, before error line

message = message[0]
rubenpurple commented 3 years ago

Hello,

In my case, i had to map in docker-compose the file "/home/hubot/node_modules/hubot-rocketchat/src/rocketchat.js". In the file, i search "._id" and just before the found line, i write "newmsg = newmsg.slice(0,1).shift();"

image