Closed saschafoerster closed 5 years ago
Could you please try to pin the package to something <2 because version 2 supports only hubot-rocketchat v2 adapter
and Hubot v3
See #10
Please let me know if that solves your issue.
Thanks for your work so far. I'm having the exact same problem as Sascha and tried to pin hubot-rss-rolf
to 1.3.1. Unfortunately, it fails at startup stating ERROR Error loading scripts from npm package - Error: Cannot find module 'hubot-rss-rolf@1.3.1'
I'm running rocketchat and rocketchat-hubot including script using docker-compose. How would I pin the package to 1.3.1 correctly? My syntax:
hubot:
image: rocketchat/hubot-rocketchat:latest
environment:
- EXTERNAL_SCRIPTS=hubot-seen,someotherscripts,hubot-rss-rolf@1.3.1
Yes that should be correct, but maybe the hubot-rocketchat container is not correct. In our old setup we used rocketchat/hubot-rocketchat:v1.0.11
Can you by any chance upgrade to the new hubot?
I tried all the different combinations in my docker-compose.yml, none worked:
# - "EXTERNAL_SCRIPTS=hubot-help,hubot-giphy-gifme,hubot-rss-rolf@1.3.1"
- EXTERNAL_SCRIPTS=hubot-help,hubot-giphy-gifme,hubot-rss-rolf
image: "rocketchat/hubot-rocketchat:latest"
# image: "rocketchat/hubot-rocketchat:v1.0.11"
[Sat Nov 03 2018 22:37:43 GMT+0000 (UTC)] INFO Starting Rocketchat adapter version 1.0.11...
[Sat Nov 03 2018 22:37:43 GMT+0000 (UTC)] INFO Once connected to rooms I will respond to the name: hubot
[Sat Nov 03 2018 22:37:43 GMT+0000 (UTC)] INFO Connecting To: rocketchat:3000
[Sat Nov 03 2018 22:37:43 GMT+0000 (UTC)] INFO Successfully connected!
[Sat Nov 03 2018 22:37:43 GMT+0000 (UTC)] INFO
[Sat Nov 03 2018 22:37:43 GMT+0000 (UTC)] INFO Logging In
[Sat Nov 03 2018 22:37:45 GMT+0000 (UTC)] INFO Successfully Logged In
[Sat Nov 03 2018 22:37:45 GMT+0000 (UTC)] INFO rid: []
[Sat Nov 03 2018 22:37:45 GMT+0000 (UTC)] INFO All rooms joined.
[Sat Nov 03 2018 22:37:45 GMT+0000 (UTC)] INFO Preparing Meteor Subscriptions..
[Sat Nov 03 2018 22:37:45 GMT+0000 (UTC)] INFO Subscribing to Room: __my_messages__
[Sat Nov 03 2018 22:37:46 GMT+0000 (UTC)] INFO Successfully subscribed to messages
[Sat Nov 03 2018 22:37:46 GMT+0000 (UTC)] INFO Setting up reactive message list...
[Sat Nov 03 2018 22:37:46 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.
[Sat Nov 03 2018 22:37:46 GMT+0000 (UTC)] ERROR Error loading scripts from npm package - Error: Cannot find module 'hubot-rss-rolf@2.0.0-beta1'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Robot.loadExternalScripts (/home/hubot/node_modules/hubot/src/robot.coffee:401:11)
at /home/hubot/node_modules/hubot/bin/hubot:159:26
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
I think the docker image for "rocketchat/hubot-rocketchat:latest" is outdated.
For our setup we use the bot like this:
We've cloned https://github.com/RocketChat/hubot-rocketchat-boilerplate and adjusted external-scripts.json and package.json and build the container by ourself.
# external-scripts.json
["hubot-help","hubot-redis-brain","hubot-http-status","hubot-rss-rolf"]
# package.json
{
"name": "hubot-rocketchat-boilerplate",
"version": "0.0.0-develop",
"description": "An example Hubot demonstrating usage of the Rocket.Chat adaptor.",
"main": "bin/hubot",
"repository": "git@github.com:RocketChat/hubot-rocketchat-boilerplate.git",
"author": "Tim Kinnane <tim.kinnane@rocket.chat>",
"license": "MIT",
"private": false,
"keywords": [
"hubot",
"rocketchat",
"chatbot",
"chat"
],
"engines": {
"node": ">=8.x",
"npm": ">=5.x"
},
"scripts": {
"debug": "node --inspect --inspect-brk -r dotenv/config node_modules/hubot/bin/hubot.js -a rocketchat",
"shell": "node -r dotenv/config node_modules/hubot/bin/hubot.js -a shell",
"local": "node -r dotenv/config node_modules/hubot/bin/hubot.js -a rocketchat"
},
"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"
},
"devDependencies": {
"dotenv": "^5.0.1"
}
}
# Dockerfile
FROM node:8.11.2
RUN useradd hubot -m
USER hubot
COPY ./bin /home/hubot/bin/
COPY ./scripts /home/hubot/scripts/
COPY package.json /home/hubot/package.json
COPY external-scripts.json /home/hubot/external-scripts.json
USER root
RUN chown hubot:hubot -R /home/hubot/bin
RUN chmod +x /home/hubot/bin/hubot
WORKDIR /home/hubot
USER hubot
RUN npm install
CMD bin/hubot
# docker-compose.yml
...
hubot:
restart: always
build: .
environment:
...
- EXTERNAL_SCRIPTS=hubot-help,hubot-redis-brain,hubot-http-status,hubot-rss-rolf
I don't know if it would be helpful if I build and publish the container for you guys because I am not quite sure if this is a good solution.
I get pretty far with it, but it ends with a timeout:
up to date in 8.277s
Wed, 21 Nov 2018 22:31:52 GMT body-parser deprecated undefined extended: provide extended option at node_modules/hubot/src/robot.js:445:21
[Wed Nov 21 2018 22:31:52 GMT+0000 (UTC)] INFO [startup] Rocket.Chat adapter in use
[Wed Nov 21 2018 22:31:52 GMT+0000 (UTC)] INFO [startup] Respond to name: Hubot
[Wed Nov 21 2018 22:31:52 GMT+0000 (UTC)] INFO [startup] Respond to alias: bonnbot
[Wed Nov 21 2018 22:31:52 GMT+0000 (UTC)] INFO [connect] Connecting { username: 'bonnbot',
password: '########',
ldap: false,
host: 'rocketchat:3000',
useSsl: false,
timeout: 20000,
rooms: [ '\'\'' ],
allPublic: true,
dm: true,
livechat: true,
edited: false,
integrationId: 'js.SDK',
roomCacheMaxSize: 10,
roomCacheMaxAge: 300000,
dmCacheMaxSize: 10,
dmCacheMaxAge: 100000 }
[Wed Nov 21 2018 22:32:12 GMT+0000 (UTC)] INFO [connect] Timeout (20000)
[Wed Nov 21 2018 22:32:12 GMT+0000 (UTC)] ERROR Unable to connect: {}
[Wed Nov 21 2018 22:32:12 GMT+0000 (UTC)] ERROR undefined
[Wed Nov 21 2018 22:32:12 GMT+0000 (UTC)] ERROR Unable to login: {}
[Wed Nov 21 2018 22:32:12 GMT+0000 (UTC)] ERROR undefined
[Wed Nov 21 2018 22:32:12 GMT+0000 (UTC)] ERROR Unable to subscribe {}
(node:7) UnhandledPromiseRejectionWarning: Error: Asteroid connection timeout
at Timeout._onTimeout (/home/hubot/node_modules/@rocket.chat/sdk/dist/lib/driver.js:94:25)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
(node:7) 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(). (rejection id: 1)
(node:7) [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.
Okay, by giving hubot some time to start later with:
sudo docker-compose stop hubot
sudo docker-compose up -d hubot
I finally can start Hubot, but RSS-rolf is not happy:
INFO /home/hubot/node_modules/hubot-rss-rolf/scripts/hubot-rss-reader.js is using deprecated documentation syntax
Okay, it seems, that it works, but it lost all feeds from before and it doesn't show up in hubot help. But I guess the main-problem is solved.
The feeds are probably lost because the redis database lost its data.
The broken help will be tracked in https://github.com/Flipez/hubot-rss-rolf/issues/14
I want to restart the hubot via docker-compose, but It never goes live. It worked till some weeks ago though. I guess it doesn't work anymore because of your updates. If I can help debug it, let me know. Here is the log file: