Glitch app only launches on editor/console; goes off once editor/console is closed, homepage doesn't start it

Hi,
I’m trying to use Glitch to host a Discord bot and have managed to make my code work except… the code only runs if I’m using the editor, or looking at the console. If I close either, the script instantly stops working (and my bot goes offline). Visiting my project’s homepage does not seem to start the script either.
I don’t know if there’s something wrong in my code that causes it to only run when the console is open, or if I’m mistaken on the use of Glitch lol.

On another note, I’ve set up UptimeRobot as well and it seems unable to find my project (shows no uptime nor downtime).

My project’s name is sunshine-kachbot. Any help appreciated, thank you.

Hey @kachx, welcome to the Glitch forum!

The issue here, I think, is that you’ve set the PORT environment variable in your project’s .env file to an invalid value. Generally speaking it’s best to let Glitch control the PORT - we’ll set it to the appropriate value (typically 3000, but that can change under certain circumstances).

If you remove that line from your .env file I think things will start working appropriately.

Thank you! I looked up things and some boards I found had said to write something like this but I guess that was wrong aha. It seems like the app is properly working now even when I have the editor closes, thanks so much!

Well, UptimeRobot still seems to not do anything, though.:sweat:

Can you share a screenshot of your UptimeRobot config for this project?

Thought I followed instructions. Not sure if the config is wrong?

image

That all looks right! I checked on your project and it seems like it just hadn’t restarted after you removed the PORT value, so hadn’t picked up the change. I ran the refresh command in your project’s console and everything looks good now!

I still have nothing on there. :frowning: The app itself seems to run fine, but for some reason UptimeRobot doesn’t seem to be able to connect to it.

Well, seems like it just needed some time (an hour) to start working.:sweat_smile:
Thanks once again for the original help.

Yep, I added a robot to your project and it just came up about 30 mins after I added it.

I wouldn’t have expected that, but https://sunshine-kachbot.glitch.me/ seemed up the whole time, so I’m not sure what happened there.