Flipez / hubot-rss-rolf

RSS Reader on Hubot
https://www.npmjs.org/package/hubot-rss-rolf
9 stars 4 forks source link

ERROR ReferenceError: room is not defined #10

Closed hhyyrylainen closed 6 years ago

hhyyrylainen commented 6 years ago

I get this error when the bot tries to post rss entries:

ERROR ReferenceError: room is not defined                     
    at Timeout._onTimeout (/home/hubot/myhubot/node_modules/hubot-rss-rolf/scripts/hubot-rss-reader.coffe
e:71:51)                                                                                                 
    at ontimeout (timers.js:475:11)                                                                      
    at tryOnTimeout (timers.js:310:5)                                                                    
    at Timer.listOnTimeout (timers.js:270:5)

I found a fix for this. Change the setInterval part to look like this:

  setInterval ->
    return if typeof robot.send isnt 'function'
    return if send_queue.length < 1
    msg = send_queue.shift()
    msg.envelope.user = {}
    try
      robot.send msg.envelope, msg.body
    catch err
      logger.error "Error sending message in setInterval"
      logger.error err
  , 2000

Maybe this is caused by using a newer rocketchat connector.

Flipez commented 6 years ago

Hi, does this happen always or only from time to time?

hhyyrylainen commented 6 years ago

Before I made that change I didn't manage to get the bot to post any rss items at all and after that it just worked the next time I registered a new rss feed. So at least for me it happened 100% of the time.

Flipez commented 6 years ago

What version of RocketChat are you running?

At least for us the bot still works fine :thinking:

hhyyrylainen commented 6 years ago

I used the latest release and the latest hubot rocketchat connector (which might be what has this change)

Flipez commented 6 years ago

Unfortunately I am no longer maintaining our RocketChat, if you could paste me some version numbers I'll check back with our instance admin so we can figure out what might have introduced this.

hhyyrylainen commented 6 years ago

My rocket chat version is 0.66.1 and my hubot package versions are (pretty confusingly): hubot-rocketchat@2.0.0 and hubot@2.19.0 but under hubot-rocketchat npm list also prints hubot@3.0.1.

Flipez commented 6 years ago

As I already assumed we are running a older version of hubot. It seems that there were some bigger changes which require a lot more work that I thought. According to this changes the bot should also be rewritten in js :/

https://www.npmjs.com/package/hubot-rocketchat#important

Flipez commented 6 years ago

I am going to rewrite the whole bot into ES6 and make in compatible with the new hubot-rocketchat v2 adapter and Hubot v3. I try to keep as much features as possible.

Flipez commented 6 years ago

@hhyyrylainen Can you please check if hubot-rss-rolf@2.0.0-beta1 does work somewhat for you?

I've got it running using the following dependencies:

  "dependencies": {
    "hubot": "3",
    "hubot-help": "^1.0.1",
    "hubot-http-status": "^0.2.2",
    "hubot-redis-brain": "^1.0.0",
    "hubot-rocketchat": "github:rocketchat/hubot-rocketchat",
    "hubot-rss-rolf": "2.0.0-beta1"
hhyyrylainen commented 6 years ago

Unfortunately I decided that rocketchat didn't work well enough so I have already removed it so I can't easily test to see if the new version works.

realrill commented 5 years ago

@Flipez I am able to regenerate the issue with 2.0.0-beta1

Could you please take a look on that?

droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO Filters passed, will receive message
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO hubot-rss-reader: add http://feeds.skynews.com/feeds/rss/world.xml
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO hubot-rss-reader: checker start
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [sendMessage] Calling (async): [{"msg":"registered http://feeds.skynews.com/feeds/rss/world.xml","bot":{"i":"js.SDK"},"rid":"qswndTHNDruLKmaiz"}]
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [received] Message in room qswndTHNDruLKmaiz
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [received] Message in room qswndTHNDruLKmaiz
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO [received] Message in room qswndTHNDruLKmaiz
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:58 GMT+0000 (Coordinated Universal Time)] INFO hubot-rss-reader: wait 600 seconds
droid_1_165c287c5d29 | [Sat Jan 26 2019 21:34:59 GMT+0000 (Coordinated Universal Time)] ERROR ReferenceError: room is not defined
droid_1_165c287c5d29 |   at Timeout._onTimeout (/home/hubot/node_modules/hubot-rss-rolf/scripts/hubot-rss-reader.js:79:61)
droid_1_165c287c5d29 |   at ontimeout (timers.js:436:11)
droid_1_165c287c5d29 |   at tryOnTimeout (timers.js:300:5)
droid_1_165c287c5d29 |   at listOnTimeout (timers.js:263:5)
droid_1_165c287c5d29 |   at Timer.processTimers (timers.js:223:10)
droid_1_165c287c5d29 |