Discord Bot project keeps restarting?

Hey everyone!

I’m currently developing a Discord Bot using NodeJS and Glitch, and it keeps restarting randomly with no error in console. I would like to know what could cause this.

Thanks in advance.

Hi @Wipeout999!

Can you tell us your project name? It is difficult to give you precise help if we can’t see the code.

One possible reason for what you’re describing is in the FAQ, that is, we put projects to sleep after 10 minutes of inactivity.

Another reason can be that your application stops by itself. We restart the app after 10 seconds if it is not running, because we assume that Glitch apps are always running.

Its about a project I am doing with a friend: Name “Married-steel”
app is getting pinged by uptimerobot, I am thinking about errors in package.json.

I confirm that the problem is the 10 minutes of inactivity. uptimerobot tries to ping it, but you didn’t set up any http server in your app, so uptimerobot doesn’t receive any response and stops trying.

Basically, you know you’re done when the “Show” button stops spinning. To do that, you’ve to setup an http server, for example using express. It’s very easy. Somewhere at the beginning of your server.js file, you can write this:

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

trigger a restart, and you should be good to go!

Thanks for your answer :slight_smile:

1 Like