Skip to content
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

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

Open
rmountjoy92 opened this issue Nov 17, 2020 · 7 comments
Open

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

rmountjoy92 opened this issue Nov 17, 2020 · 7 comments

Comments

@rmountjoy92
Copy link

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

npm info postinstall [email protected]

npm info postinstall [email protected]

npm info install [email protected]

npm info postinstall [email protected]

[email protected] node_modules/hubot-maps

[email protected] node_modules/hubot-help

[email protected] node_modules/hubot-shipit

[email protected] node_modules/hubot-google-images

[email protected] node_modules/hubot-rules

[email protected] node_modules/hubot-pugme

[email protected] node_modules/hubot-google-translate

[email protected] node_modules/hubot-diagnostics

npm info ok 

npm info it worked if it ends with ok

m info using [email protected]

m info using [email protected]

npm info preinstall [email protected]


npm info package.json [email protected] No license field.


m info build /home/hubot


npm info linkStuff [email protected]


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


npm info preinstall [email protected]


npm info linkStuff [email protected]


npm info install [email protected]


npm info postinstall [email protected]


npm info install [email protected]


npm info postinstall [email protected]


npm info prepublish [email protected]

�
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
Copy link

sschueller commented Nov 20, 2020

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 [email protected]
npm info postinstall [email protected]

> [email protected] 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 [email protected] 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! [email protected] postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 [email protected]
npm info uninstall [email protected]
npm info postuninstall [email protected]

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-
Copy link

Opa- commented Nov 23, 2020

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-
Copy link

Opa- commented Nov 24, 2020

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
Copy link

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 <[email protected]>

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
Copy link

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
Copy link

osallou commented Jan 8, 2021

@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
Copy link

rubenpurple commented Jan 28, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants