Closed vparys closed 2 years ago
Can you give me some information on what steps you took to set up the bot? 🙂
Jack
I've installed npm, git and docker on fresh debian server, cloned this repo, renamed .env-example to .env and pasted inside Application ID into CLIENT_ID, Token into DISCORD_TOKEN and the google api token into GOOGLE_API_TOKEN. Then I've built the docker container and since then I'm getting this error. It seems to me, that the problem is with sending the HTTP request because the same error occurs even after I've for example deleted .env.
It seems the code is failing to connect to Redis. Your setup procedure doesn't give me any red flags... though you shouldn't need to install npm on the host machine as npm will be bundled in as part of the Docker! 🙂
Did you run docker-compose up
in the root of the project's directory?
Yes, I did :/
It seems I have been able to reproduce your problem:
It was caused by me running the bot container by itself. This is not a bug, and entirely expected!
I am confident if you install/run that docker-compose command it will work.
The reason this is, is because when you run docker-compose, you're actually linking two containers together as services. One runs Node.js and npm, and the other runs Redis. When they run together, the two containers have their own internal network where the bot can privately communicate with the Redis container. But without docker-compose, and the bot being by itself, the connection to Redis cannot be established.
Hmmm, just seen your reply after saying you used docker-compose. I will have another think about this and get back to you.
What's the REDIS_HOST
value set to in .env? If it's not set to redis
that could also cause this issue.
Yes, it is set to redis
and I've been using docker-compose
:(. I've also tried reinstalling whole debian just in case.
Can you please pull the latest code with git pull
and run docker-compose up --build
and then send me a screenshot of the bit where it says "Redis host: ..."?
Here you go
I must say, I have spun up a new Debian 11 server and I am baffled because it also does not seem to work for me either! On my Windows Docker installation it's fine, but on Debian it is not. Still very unsure why.
And have you already tried other distributions?
I haven't yet, no. But I will do later!
same problem found on ubuntu 20.04 clean installation
I would like to thank whoever submitted a question to StackOverflow!!
https://stackoverflow.com/questions/70746842/connection-timeout-http-put-request
Found it whilst trying to fix it myself! I am still just as stumped about the problem and am still working on it.
EDIT: Just realised vparys is here, it's not easy to remember names. 😅
Hi guys I have found the reason why and I am going to issue a patch tonight!
What was the problem?
In src/classes/modules/Cache.ts and src/classes/modules/QueueManager.ts I declare a static property that holds the Redis client. HOWEVER, as I have learned tonight having more than one Redis client does not work and is most likely, from my empirical observations bad practice.
It just so happens that Windows is fine with it, but Linux does not like it at all. You learn something new every day.
Not a bug with Docker or Docker compose! Just a little bit of shabby code. 😂
That's awesome!
I also hope it didn't make you mad that I've submitted this problem on stackoverflow, just wanted to save you some time! 😄
That's awesome!
I also hope it didn't make you mad that I've submitted this problem on stackoverflow, just wanted to save you some time! 😄
Not a problem at all! StackOverflow can be... well... hostile at times. So if anything you were the punching bag for any keyboard nerds 😂 And I appreciate that.
This issue is now resolved at commit a7857dd6ec924ff7fb37ba40a74b34d85dd622d3
Thanks for the help to all involved!
Hello, recently I came across this interesting project but I am not able to get it going. I've configured .env according to readme but I'm still stuck at the same error. I'm probably missing some basic step but I haven't been able to find anything online.
Debian 11