Open bryanrossUK opened 7 years ago
I ran into the same thing. I'll make a PR that might be able to help.
👍
Strangely, I'm no longer seeing this -- I wonder if some other dep got updated that might have fixed the underlying issue? @liquidstate can you still reproduce the problem?
Apologies for taking so long to test this, but I'm still getting the same problem.
Each incoming message on the channel generates the following error:
hubot_1 | [Wed Jan 10 2018 21:38:24 GMT+0000 (UTC)] ERROR TypeError: Cannot read property 'sort' of null
hubot_1 | at TextListener.callback (/opt/hubot/node_modules/hubot-eavesdrop/src/eavesdrop.coffee:95:17, <js>:116:12)
hubot_1 | at executeListener (/opt/hubot/node_modules/hubot/src/listener.coffee:65:11, <js>:53:19)
hubot_1 | at allDone (/opt/hubot/node_modules/hubot/src/middleware.coffee:44:37, <js>:34:16)
hubot_1 | at /opt/hubot/node_modules/async/lib/async.js:274:13
hubot_1 | at Object.async.eachSeries (/opt/hubot/node_modules/async/lib/async.js:142:20)
hubot_1 | at Object.async.reduce (/opt/hubot/node_modules/async/lib/async.js:268:15)
hubot_1 | at /opt/hubot/node_modules/hubot/src/middleware.coffee:49:7, <js>:37:22
hubot_1 | at nextTickCallbackWith0Args (node.js:489:9)
hubot_1 | at process._tickCallback (node.js:418:13)
Trying to use hubot when you hear cat respond with woof
generates the following error:
hubot_1 | [Wed Jan 10 2018 21:38:46 GMT+0000 (UTC)] ERROR TypeError: Cannot read property 'push' of null
hubot_1 | at EavesDropping.add (/opt/hubot/node_modules/hubot-eavesdrop/src/eavesdrop.coffee:30:20, <js>:22:33)
hubot_1 | at TextListener.callback (/opt/hubot/node_modules/hubot-eavesdrop/src/eavesdrop.coffee:57:21, <js>:66:24)
hubot_1 | at executeListener (/opt/hubot/node_modules/hubot/src/listener.coffee:65:11, <js>:53:19)
hubot_1 | at allDone (/opt/hubot/node_modules/hubot/src/middleware.coffee:44:37, <js>:34:16)
hubot_1 | at /opt/hubot/node_modules/async/lib/async.js:274:13
hubot_1 | at Object.async.eachSeries (/opt/hubot/node_modules/async/lib/async.js:142:20)
hubot_1 | at Object.async.reduce (/opt/hubot/node_modules/async/lib/async.js:268:15)
hubot_1 | at /opt/hubot/node_modules/hubot/src/middleware.coffee:49:7, <js>:37:22
hubot_1 | at nextTickCallbackWith0Args (node.js:489:9)
hubot_1 | at process._tickCallback (node.js:418:13)
Here's the dependency tree (I've removed all non-essential modules for testing purposes):
npm WARN deprecated coffee-script@1.6.3: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
testbot@0.0.0 /tmp
+-- hubot@2.19.0
| +-- async@0.9.2
| +-- chalk@1.1.3
| | +-- ansi-styles@2.2.1
| | +-- escape-string-regexp@1.0.5
| | +-- has-ansi@2.0.0
| | | `-- ansi-regex@2.1.1
| | +-- strip-ansi@3.0.1
| | | `-- ansi-regex@2.1.1 deduped
| | `-- supports-color@2.0.0
| +-- cline@0.8.2
| +-- coffee-script@1.6.3
| +-- connect-multiparty@1.2.5
| | +-- multiparty@3.3.2
| | | +-- readable-stream@1.1.14
| | | | +-- core-util-is@1.0.2
| | | | +-- inherits@2.0.3 deduped
| | | | +-- isarray@0.0.1
| | | | `-- string_decoder@0.10.31
| | | `-- stream-counter@0.2.0
| | | `-- readable-stream@1.1.14 deduped
| | +-- on-finished@2.1.1
| | | `-- ee-first@1.1.0
| | +-- qs@2.2.5
| | `-- type-is@1.5.7
| | +-- media-typer@0.3.0
| | `-- mime-types@2.0.14
| | `-- mime-db@1.12.0
| +-- express@3.21.2
| | +-- basic-auth@1.0.4
| | +-- commander@2.6.0
| | +-- connect@2.30.2
| | | +-- basic-auth-connect@1.0.0
| | | +-- body-parser@1.13.3
| | | | +-- bytes@2.1.0 deduped
| | | | +-- content-type@1.0.4 deduped
| | | | +-- debug@2.2.0 deduped
| | | | +-- depd@1.0.1 deduped
| | | | +-- http-errors@1.3.1 deduped
| | | | +-- iconv-lite@0.4.11
| | | | +-- on-finished@2.3.0
| | | | | `-- ee-first@1.1.1
| | | | +-- qs@4.0.0
| | | | +-- raw-body@2.1.7
| | | | | +-- bytes@2.4.0
| | | | | +-- iconv-lite@0.4.13
| | | | | `-- unpipe@1.0.0 deduped
| | | | `-- type-is@1.6.15
| | | | +-- media-typer@0.3.0 deduped
| | | | `-- mime-types@2.1.17
| | | | `-- mime-db@1.30.0
| | | +-- bytes@2.1.0
| | | +-- compression@1.5.2
| | | | +-- accepts@1.2.13
| | | | | +-- mime-types@2.1.17
| | | | | | `-- mime-db@1.30.0
| | | | | `-- negotiator@0.5.3
| | | | +-- bytes@2.1.0 deduped
| | | | +-- compressible@2.0.12
| | | | | `-- mime-db@1.32.0
| | | | +-- debug@2.2.0 deduped
| | | | +-- on-headers@1.0.1 deduped
| | | | `-- vary@1.0.1 deduped
| | | +-- connect-timeout@1.6.2
| | | | +-- debug@2.2.0 deduped
| | | | +-- http-errors@1.3.1 deduped
| | | | +-- ms@0.7.1 deduped
| | | | `-- on-headers@1.0.1 deduped
| | | +-- content-type@1.0.4 deduped
| | | +-- cookie@0.1.3 deduped
| | | +-- cookie-parser@1.3.5
| | | | +-- cookie@0.1.3 deduped
| | | | `-- cookie-signature@1.0.6 deduped
| | | +-- cookie-signature@1.0.6 deduped
| | | +-- csurf@1.8.3
| | | | +-- cookie@0.1.3 deduped
| | | | +-- cookie-signature@1.0.6 deduped
| | | | +-- csrf@3.0.6
| | | | | +-- rndm@1.2.0
| | | | | +-- tsscmp@1.0.5
| | | | | `-- uid-safe@2.1.4
| | | | | `-- random-bytes@1.0.0
| | | | `-- http-errors@1.3.1 deduped
| | | +-- debug@2.2.0 deduped
| | | +-- depd@1.0.1 deduped
| | | +-- errorhandler@1.4.3
| | | | +-- accepts@1.3.4
| | | | | +-- mime-types@2.1.17
| | | | | | `-- mime-db@1.30.0
| | | | | `-- negotiator@0.6.1
| | | | `-- escape-html@1.0.3
| | | +-- express-session@1.11.3
| | | | +-- cookie@0.1.3 deduped
| | | | +-- cookie-signature@1.0.6 deduped
| | | | +-- crc@3.3.0
| | | | +-- debug@2.2.0 deduped
| | | | +-- depd@1.0.1 deduped
| | | | +-- on-headers@1.0.1 deduped
| | | | +-- parseurl@1.3.2 deduped
| | | | +-- uid-safe@2.0.0
| | | | | `-- base64-url@1.2.1
| | | | `-- utils-merge@1.0.0 deduped
| | | +-- finalhandler@0.4.0
| | | | +-- debug@2.2.0 deduped
| | | | +-- escape-html@1.0.2 deduped
| | | | +-- on-finished@2.3.0
| | | | | `-- ee-first@1.1.1
| | | | `-- unpipe@1.0.0
| | | +-- fresh@0.3.0 deduped
| | | +-- http-errors@1.3.1
| | | | +-- inherits@2.0.3 deduped
| | | | `-- statuses@1.4.0
| | | +-- method-override@2.3.10
| | | | +-- debug@2.6.9
| | | | | `-- ms@2.0.0
| | | | +-- methods@1.1.2 deduped
| | | | +-- parseurl@1.3.2 deduped
| | | | `-- vary@1.1.2
| | | +-- morgan@1.6.1
| | | | +-- basic-auth@1.0.4 deduped
| | | | +-- debug@2.2.0 deduped
| | | | +-- depd@1.0.1 deduped
| | | | +-- on-finished@2.3.0
| | | | | `-- ee-first@1.1.1
| | | | `-- on-headers@1.0.1 deduped
| | | +-- multiparty@3.3.2 deduped
| | | +-- on-headers@1.0.1
| | | +-- parseurl@1.3.2 deduped
| | | +-- pause@0.1.0
| | | +-- qs@4.0.0
| | | +-- response-time@2.3.2
| | | | +-- depd@1.1.1
| | | | `-- on-headers@1.0.1 deduped
| | | +-- serve-favicon@2.3.2
| | | | +-- etag@1.7.0 deduped
| | | | +-- fresh@0.3.0 deduped
| | | | +-- ms@0.7.2
| | | | `-- parseurl@1.3.2 deduped
| | | +-- serve-index@1.7.3
| | | | +-- accepts@1.2.13 deduped
| | | | +-- batch@0.5.3
| | | | +-- debug@2.2.0 deduped
| | | | +-- escape-html@1.0.3
| | | | +-- http-errors@1.3.1 deduped
| | | | +-- mime-types@2.1.17
| | | | | `-- mime-db@1.30.0
| | | | `-- parseurl@1.3.2 deduped
| | | +-- serve-static@1.10.3
| | | | +-- escape-html@1.0.3
| | | | +-- parseurl@1.3.2 deduped
| | | | `-- send@0.13.2
| | | | +-- debug@2.2.0 deduped
| | | | +-- depd@1.1.1
| | | | +-- destroy@1.0.4
| | | | +-- escape-html@1.0.3 deduped
| | | | +-- etag@1.7.0 deduped
| | | | +-- fresh@0.3.0 deduped
| | | | +-- http-errors@1.3.1 deduped
| | | | +-- mime@1.3.4 deduped
| | | | +-- ms@0.7.1 deduped
| | | | +-- on-finished@2.3.0
| | | | | `-- ee-first@1.1.1
| | | | +-- range-parser@1.0.3 deduped
| | | | `-- statuses@1.2.1
| | | +-- type-is@1.6.15
| | | | +-- media-typer@0.3.0 deduped
| | | | `-- mime-types@2.1.17
| | | | `-- mime-db@1.30.0
| | | +-- utils-merge@1.0.0 deduped
| | | `-- vhost@3.0.2
| | +-- content-disposition@0.5.0
| | +-- content-type@1.0.4
| | +-- cookie@0.1.3
| | +-- cookie-signature@1.0.6
| | +-- debug@2.2.0
| | | `-- ms@0.7.1
| | +-- depd@1.0.1
| | +-- escape-html@1.0.2
| | +-- etag@1.7.0
| | +-- fresh@0.3.0
| | +-- merge-descriptors@1.0.0
| | +-- methods@1.1.2
| | +-- mkdirp@0.5.1
| | | `-- minimist@0.0.8
| | +-- parseurl@1.3.2
| | +-- proxy-addr@1.0.10
| | | +-- forwarded@0.1.2
| | | `-- ipaddr.js@1.0.5
| | +-- range-parser@1.0.3
| | +-- send@0.13.0
| | | +-- debug@2.2.0 deduped
| | | +-- depd@1.0.1 deduped
| | | +-- destroy@1.0.3
| | | +-- escape-html@1.0.2 deduped
| | | +-- etag@1.7.0 deduped
| | | +-- fresh@0.3.0 deduped
| | | +-- http-errors@1.3.1 deduped
| | | +-- mime@1.3.4
| | | +-- ms@0.7.1 deduped
| | | +-- on-finished@2.3.0
| | | | `-- ee-first@1.1.1
| | | +-- range-parser@1.0.3 deduped
| | | `-- statuses@1.2.1
| | +-- utils-merge@1.0.0
| | `-- vary@1.0.1
| +-- log@1.4.0
| +-- optparse@1.0.4
| `-- scoped-http-client@0.11.0
+-- hubot-eavesdrop@2.2.1
| +-- abbrev@1.0.7
| +-- assertion-error@1.0.1
| +-- coffee-script@1.6.3
| +-- commander@0.6.1
| +-- cookiejar@1.3.0
| +-- debug@0.7.4
| +-- deep-eql@0.1.3
| | `-- type-detect@0.1.1
| +-- diff@1.0.7
| +-- emitter-component@1.0.0
| +-- escape-string-regexp@1.0.2
| +-- faye-websocket@0.4.4
| +-- formatio@1.1.1
| | `-- samsam@1.1.2 deduped
| +-- formidable@1.0.14
| +-- gaze@0.4.3
| | `-- globule@0.1.0 deduped
| +-- glob@3.1.21
| | +-- graceful-fs@1.2.3 deduped
| | +-- inherits@1.0.2 deduped
| | `-- minimatch@0.2.14 deduped
| +-- globule@0.1.0
| | +-- glob@3.1.21 deduped
| | +-- lodash@1.0.2 deduped
| | `-- minimatch@0.2.14 deduped
| +-- graceful-fs@1.2.3
| +-- growl@1.7.0
| +-- inherits@1.0.2
| +-- jade@0.26.3
| | +-- commander@0.6.1 deduped
| | `-- mkdirp@0.3.0
| +-- lodash@1.0.2
| +-- lolex@1.3.2
| +-- lru-cache@2.7.3
| +-- methods@0.0.1
| +-- mime@1.2.5
| +-- minimatch@0.2.14
| | +-- lru-cache@2.7.3 deduped
| | `-- sigmund@1.0.1 deduped
| +-- minimist@0.0.8
| +-- mkdirp@0.3.5
| +-- ms@0.7.1
| +-- nopt@2.0.0
| | `-- abbrev@1.0.7 deduped
| +-- noptify@0.0.3
| | `-- nopt@2.0.0 deduped
| +-- qs@0.5.6
| +-- reduce-component@1.0.1
| +-- samsam@1.1.2
| +-- semver@2.0.11
| +-- shelljs@0.1.4
| +-- sigmund@1.0.1
| +-- superagent@0.15.7
| | +-- cookiejar@1.3.0 deduped
| | +-- debug@0.7.4 deduped
| | +-- emitter-component@1.0.0 deduped
| | +-- formidable@1.0.14 deduped
| | +-- methods@0.0.1 deduped
| | +-- mime@1.2.5 deduped
| | +-- qs@0.6.5
| | `-- reduce-component@1.0.1 deduped
| +-- supports-color@1.2.0
| +-- tiny-lr@0.0.4
| | +-- debug@0.7.4 deduped
| | +-- faye-websocket@0.4.4 deduped
| | +-- noptify@0.0.3 deduped
| | `-- qs@0.5.6 deduped
| +-- type-detect@1.0.0
| `-- util@0.10.3
| `-- inherits@2.0.1
+-- hubot-redis-brain@0.0.4
| `-- redis@2.6.5
| +-- double-ended-queue@2.1.0-0
| +-- redis-commands@1.3.1
| `-- redis-parser@2.6.0
`-- hubot-slack@4.4.0
+-- @slack/client@3.15.0
| +-- async@1.5.2
| +-- bluebird@3.5.1
| +-- eventemitter3@1.2.0
| +-- https-proxy-agent@1.0.0
| | +-- agent-base@2.1.1
| | | +-- extend@3.0.1 deduped
| | | `-- semver@5.0.3
| | +-- debug@2.2.0 deduped
| | `-- extend@3.0.1
| +-- inherits@2.0.3
| +-- lodash@4.17.4
| +-- pkginfo@0.4.1
| +-- request@2.76.0
| | +-- aws-sign2@0.6.0
| | +-- aws4@1.6.0
| | +-- caseless@0.11.0
| | +-- combined-stream@1.0.5
| | | `-- delayed-stream@1.0.0
| | +-- extend@3.0.1 deduped
| | +-- forever-agent@0.6.1
| | +-- form-data@2.1.4
| | | +-- asynckit@0.4.0
| | | +-- combined-stream@1.0.5 deduped
| | | `-- mime-types@2.1.17
| | | `-- mime-db@1.30.0
| | +-- har-validator@2.0.6
| | | +-- chalk@1.1.3 deduped
| | | +-- commander@2.12.2
| | | +-- is-my-json-valid@2.17.1
| | | | +-- generate-function@2.0.0
| | | | +-- generate-object-property@1.2.0
| | | | | `-- is-property@1.0.2
| | | | +-- jsonpointer@4.0.1
| | | | `-- xtend@4.0.1
| | | `-- pinkie-promise@2.0.1
| | | `-- pinkie@2.0.4
| | +-- hawk@3.1.3
| | | +-- boom@2.10.1
| | | | `-- hoek@2.16.3 deduped
| | | +-- cryptiles@2.0.5
| | | | `-- boom@2.10.1 deduped
| | | +-- hoek@2.16.3
| | | `-- sntp@1.0.9
| | | `-- hoek@2.16.3 deduped
| | +-- http-signature@1.1.1
| | | +-- assert-plus@0.2.0
| | | +-- jsprim@1.4.1
| | | | +-- assert-plus@1.0.0
| | | | +-- extsprintf@1.3.0
| | | | +-- json-schema@0.2.3
| | | | `-- verror@1.10.0
| | | | +-- assert-plus@1.0.0
| | | | +-- core-util-is@1.0.2 deduped
| | | | `-- extsprintf@1.3.0 deduped
| | | `-- sshpk@1.13.1
| | | +-- asn1@0.2.3
| | | +-- assert-plus@1.0.0
| | | +-- bcrypt-pbkdf@1.0.1
| | | | `-- tweetnacl@0.14.5 deduped
| | | +-- dashdash@1.14.1
| | | | `-- assert-plus@1.0.0
| | | +-- ecc-jsbn@0.1.1
| | | | `-- jsbn@0.1.1 deduped
| | | +-- getpass@0.1.7
| | | | `-- assert-plus@1.0.0
| | | +-- jsbn@0.1.1
| | | `-- tweetnacl@0.14.5
| | +-- is-typedarray@1.0.0
| | +-- isstream@0.1.2
| | +-- json-stringify-safe@5.0.1
| | +-- mime-types@2.1.17
| | | `-- mime-db@1.30.0
| | +-- node-uuid@1.4.8
| | +-- oauth-sign@0.8.2
| | +-- qs@6.3.2
| | +-- stringstream@0.0.5
| | +-- tough-cookie@2.3.3
| | | `-- punycode@1.4.1
| | `-- tunnel-agent@0.4.3
| +-- retry@0.9.0
| +-- url-join@0.0.1
| +-- winston@2.4.0
| | +-- async@1.0.0
| | +-- colors@1.0.3
| | +-- cycle@1.0.3
| | +-- eyes@0.1.8
| | +-- isstream@0.1.2 deduped
| | `-- stack-trace@0.0.10
| `-- ws@1.1.5
| +-- options@0.0.6
| `-- ultron@1.0.2
`-- lodash@3.10.1
@liquidstate to clarify, you reproduced the problem using my fork (commit be3673aa02f22ae0f95cbe5bb9292ed2af684254)?
Sorry @acrewdson - didn't spot the fork. Many thanks for your help, much appreciated!
With the fork, i'm happy to report that it works! Not 100% bug free though I'm afraid!
With a fresh install and an empty brain with your fork I get the following error on all incoming messages:
hubot_1 | [Thu Jan 11 2018 22:59:29 GMT+0000 (UTC)] ERROR TypeError: Cannot read property 'sort' of null
hubot_1 | at TextListener.callback (/opt/hubot/node_modules/hubot-eavesdrop/src/eavesdrop.coffee:95:17, <js>:116:12)
hubot_1 | at executeListener (/opt/hubot/node_modules/hubot/src/listener.coffee:65:11, <js>:53:19)
hubot_1 | at allDone (/opt/hubot/node_modules/hubot/src/middleware.coffee:44:37, <js>:34:16)
hubot_1 | at /opt/hubot/node_modules/async/lib/async.js:274:13
hubot_1 | at Object.async.eachSeries (/opt/hubot/node_modules/async/lib/async.js:142:20)
hubot_1 | at Object.async.reduce (/opt/hubot/node_modules/async/lib/async.js:268:15)
hubot_1 | at /opt/hubot/node_modules/hubot/src/middleware.coffee:49:7, <js>:37:22
hubot_1 | at nextTickCallbackWith0Args (node.js:489:9)
hubot_1 | at process._tickCallback (node.js:418:13)
However, once I create an action, such as when you hear dog respond with woof
I get two notifications in the channel from the bot. Eg:
bryan: testbot when you hear dog respond with woof
testbot: I am now listening for dog.
testbot: I am now listening for dog.
And, when I trigger that action, I get four responses from the bot. Eg:
bryan: nice dog
testbot: woof
testbot: woof
testbot: woof
testbot: woof
If I create further actions, then I get the same two confirmations and four responses when the action is triggered.
After creating an action, I no longer receive the same error as before on every message to the channel though. My guess is that this block of code doesn't deal well with an empty array?
tasks = eavesDropper.all()
tasks.sort (a,b) ->
return if a.order >= b.order then 1 else -1
@liquidstate thanks for testing. I'll take another look. All signs point to some tricky race conditions that are not going to be easily fixed, since I didn't see any of what you describe last time I tested this -- but I also saw other weirdnesses that pointed to non-deterministic stuff going on. So I can't say I'm too surprised you found weird behavior, too. Will get back to you.
Hi,
With
hubot-2.19
withredis-brain-v0.0.4
and I get the following errors when I try to usehubot-eavesdrop-2.2.1
. Any ideas on how to fix this?