I am hosting a discord bot on Glitch. I have configured Uptimebot to prevent the project from sleeping. But, after about 12 hours, the bot goes offline and I need to re-send the command in the console to restart it. Does Glitch automatically shut down projects after a few hours or is it a bug in my project?
It does shut down after 12 hr but if ur using uptime robot , it won’t matter
I am using uptime bot, but it is still shutting down. Is there any way to find out why this is happening?
Contact me on Discord - iona Dev#8394 ,
We can discuss there more.
Also you will get help here too
I am getting an error. Can you send me a friend request? Here’s my username - Master Adit ᵛᵉʳᶦᶠᶦᵉᵈ#8363
Projects forced awake and running for more than 12 hours are stopped. They wake again when they receive another HTTP request. See https://glitch.com/help/restrictions/
For me the Uptime Robot request makes it wake up after it’s stopped, I don’t need to run anything to keep it running.
That’s what is called as forced awake! Aka http request
Yes but the http request makes it start again a few minutes after it is stopped
But the bot I am hosting on glitch remains offline. Is there any way I can automatically send
pm2 start <bot_file>.js every 12 hours?
Then it’s not setup properly. Let us know the project name and we’ll take a look.
If you google “Anidiotsguide hosting discord bot on glitch” they can actually walk you through what to do lol. @masteradit
They actually suggest the setInterval() technique of keeping a project awake, which is what fails to work after 12 hours. You should use a third-party service to ping the URL instead.
They do mention that, saying that even you recommended using uptime robot. But I followed this and set up uptime, haven’t had my bot go down once (except for errors and when I personally kill it)
Near the bottom it states
Glitch puts projects to sleep after 5 minutes of inactivity, with the code you used near the start of the guide you should have at least one step towards keeping your bot online 24/7, how ever there is another tool you can use, and this is promoted by the Glitch team, and that tool is Uptime Robot.
First you will need to go to the web address of your project (
https://project-name.glitch.me ). Then login to Uptime Robot and click on
+ Add new monitor , set monitor type as
HTTP(S) , give the monitor a name and in the URL field paste in your glitch project URL. Don’t forget to set the monitoring interval to
Every 5 minutes (default) , click save and job’s done!
Ah, so that’s why we see so many folks needlessly using both techniques. Thanks.
XD better to be safe than sorry. I use watch.json because if I edit watch.json it reinstalls all node modules, helping when I have an error (sometimes)
As the project is private, I have sent you the edit link in a message.
As stated in one of my previous replies, I am using the Uptime bot. But idk why it still goes offline after 12 hours.
Your app was only automatically starting the Express server and not the Discord bot. So if you manually start the Discord, after your project is forced to sleep after 12 hours all that is starting back up with a subsequent ping from Uptime Robot is the Express server, not the bot. I’ve combined the two together so they now both start, and therefore will both re-start automatically.
Thank you so much @Gareth!
Please check my solution here: Not letting the App go down