Discord bot keeps restarting randomly without error in logs


#1

I’ve been having this problem for a couple of weeks now where the I just see in the logs that the bot restarted a couple hours ago for no reason, I even have a couple of stuff in the code to output it and save the errors but there’s nothing…
I tried using the code

const express = require("express")
const expressApp = express()
expressApp.get("/", (req, res) => res.json("OK"))
expressApp.listen(process.env.PORT)

and having around 2 different websites ping the bot every couple of minutes but it still restarts a couple times per day. Can a moderator help please? I’ll invite you to edit


MOD EDIT: formatting


#2

Hey @PixelMania sorry for the bother!

I think what you’re seeing is expected behavior. By design Glitch projects restart around 12 hours after the previous restart, and there’s no way around this - the closest you can come is to have something like UptimeRobot ping your project every 5 minutes or so, which will start it up around 5 minutes after the container stops. It sounds like you’re already doing this, so you’re in the best position you can be.

We plan to have paid options sometime in the future and that may include always-on projects. There are some topics in https://support.glitch.com/c/feature-ideas for features in that area; I encourage you to vote for one or create a new one if you’re interested.

Let me know if I’ve misinterpreted your issue and I’ll take another look.


#3

Oh okay thank you for the information I didn’t know they restart every 12 hours