Glitch.me project appears down even though not - Uptime robot

stuck

Hello, I’ve seen some suggestions here saying Uptime Robot will help keep my bot alive. My uptime robot says my app is down (even though I know from discord server that it is online). I’m uploading the screenshot of my “projectname.glitch.me” site. Basically it’s stuck like that. Even though I didn’t edit index.html, the default page is should be different.

Is it possibly because I changed my project name to something non-unique 2 days ago?

1 Like

Hi, what’s your project name so I can take a look at the code?

Hi @Nameless9! Chances are that your projects server isn’t serving up a default route. For example if you’re using Express to serve your public pages you’ll need something that looks like

app.get('/', function(request, response) {
  response.sendFile(__dirname + '/views/index.html');
});

And something that looks like

const listener = app.listen(process.env.PORT, function() {
  console.log('Your app is listening on port ' + listener.address().port);
});

If you’re missing those pieces your app’s public page will never load.

As @levistep32 points out, knowing your project name will help us give more specific answers.

Thank you for your replies. You are right. I didn’t make a routing for my discord.js bot yet, so that’s a logical explanation. My project name is geniusbot.

Edit: I’m not using Express yet. So I guess I should install express and follow the guide on routing?

You’ve actually got Express already installed so that’s a start. You could put this in place by creating a file called server.js with these contents:

const express = require("express");
const app = express();

app.get("/", (request, response) => {
  console.log("Ping received!");
  response.sendStatus(200);
});

// listen for requests :)
const listener = app.listen(process.env.PORT, function() {
  console.log('Your app is listening on port ' + listener.address().port);
});

and then in bot.js include this line:
const server = require('./server.js');

Then your bot will have an empty web page responding at https://geniusbot.glitch.me that UptimeRobot can ping.

1 Like

thank you for your help cori. the website is up and it looks like it’s good from uptime robot’s side too. thanks again

Hello it does not work for me
my bot keep going offline wen i close visualisation studio code

Hi @wolfgirl416, welcome to the Glitch Forums!

UptimeRobot won’t keep your bot itself running, just the project that’s hosting it; there are any number of reason the project might be running but the bot not.

I’m not quite sure how Visual Studio Code is related to the problem you’re seeing, but maybe you can tell us more about how VS Code is involved? Also your project name might help, and a snapshot of your UptimeRobot config if you think that might not be working.

I have tried the code you suggested on Nov 18, but I am getting this response:

internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module ‘express’
Require stack:
- C:\Users\thewe\Desktop\SS assistance bot\server.js
- C:\Users\thewe\Desktop\SS assistance bot\bot.js
e[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)e[39m
e[90m at Function.Module._load (internal/modules/cjs/loader.js:686:27)e[39m
e[90m at Module.require (internal/modules/cjs/loader.js:848:19)e[39m
e[90m at require (internal/modules/cjs/helpers.js:74:18)e[39m
at Object. (C:\Users\thewe\Desktop\SS assistance bot\server.js:1:17)
e[90m at Module._compile (internal/modules/cjs/loader.js:955:30)e[39m
e[90m at Object.Module._extensions…js (internal/modules/cjs/loader.js:991:10)e[39m
e[90m at Module.load (internal/modules/cjs/loader.js:811:32)e[39m
e[90m at Function.Module._load (internal/modules/cjs/loader.js:723:14)e[39m
e[90m at Module.require (internal/modules/cjs/loader.js:848:19)e[39m {
code: e[32m’MODULE_NOT_FOUND’e[39m,
requireStack: [
e[32m’C:\Users\thewe\Desktop\SS assistance bot\server.js’e[39m,
e[32m’C:\Users\thewe\Desktop\SS assistance bot\bot.js’e[39m
]
}

Do you know how to help?

You need to have express installed and pinging was banned btw

I have installed express, but why was pinging banned?

Pinging was banned so Glitch works better for everyone.

Ok. I think I might have found the problem. Does this only work with a bot made with glitch? I have made this bot myself.

All pinging is banned

1 Like