Uptimerobot not working - discord bot

Please consider providing your Glitch project’s name in your post. Many problems are very difficult to troubleshoot without being able to see the code involved. Users who haven’t been invited to your project won’t be able to edit your code or see the secrets in your .env file just from your project name.

Alternatively provide some code that gives community members some context around your problem. Use the code formatting tool to make your code easier to read.

Uptimerobot can’t keep my Discord bot online. (timeout error - see gif below) Can’t make code public as it contains my discord code that can’t be put online.
If anyone could help get it to work, that would be great!
Eddie

You need to create a http or an express server first.

Is there a guide on how to do this?

Eddie

Hello @EddiesTech,
Welcome to the glitch community!

Could you please send a screenshot of your uptime robots configuration, and please tell me the name of your projects!

Thanks in advance!

Ok, can you please do the following:

In your main file (index.js or whatever you have it called) add the following:

require("/app/express.js")

That can be added to the top of the file!

Next, create a file “express.js” and add the following:

const express = require('express')
const app = express()

app.get('/', (req, res) => res.send('Ok'))

app.listen(process.env.PORT, () => console.log(`Example app listening on port ${port}!`))

Tell me if that solves the issue! :slight_smile:

internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module ‘express’

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)

at Function.Module._load (internal/modules/cjs/loader.js:508:25)

at Module.require (internal/modules/cjs/loader.js:637:17)

at require (internal/modules/cjs/helpers.js:22:18)

Jump Toat Object. (/app/express.js:1:79)

at Module._compile (internal/modules/cjs/loader.js:701:30)

at Object.Module._extensions…js (internal/modules/cjs/loader.js:712:10)

at Module.load (internal/modules/cjs/loader.js:600:32)

at tryModuleLoad (internal/modules/cjs/loader.js:539:12)

at Function.Module._load (internal/modules/cjs/loader.js:531:3)

Any help on this error?

Any of these steps will solve the issue:

  • Head to your projects console and type npm i express

or

  • Open package.json, go to top left and click on the “find package” button, type “express” then tap on express when it pops up

That fixed that error… but now another! :slight_smile:

/app/express.js:6
app.listen(process.env.PORT, () => console.log(Example app listening on port ${port}!))

^

ReferenceError: port is not defined

Jump Toat Server.app.listen (/app/express.js:6:81)

at Object.onceWrapper (events.js:277:13)

at Server.emit (events.js:189:13)

at emitListeningNT (net.js:1304:10)

at process._tickCallback (internal/process/next_tick.js:63:19)

at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)

at startup (internal/bootstrap/node.js:283:19)

at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Ah, change that line to the following:

app.listen(process.env.PORT, () => console.log("Your app is listening on port " + process.env.PORT)})

Seems to be working great!
Thank you very much! :slight_smile:

1 Like