Project shuts down randomly


#1

Hi, I have my bot on glitch and it works, but after like some minutes it shuts down randomly, and i have to go back to glitch and restart it. How do i fix this, i already have it on uptime robot, and its ok on there so idk why it just shuts down randomly. Please help


My project is shutting down randomly
#2

Hey @ramoth123 if your project appears to be up in UptimeRobot consistently then it’s unlikely this is a Glitch-specific problem, as Glitch is successfully running your project and rendering the web page UptimeRobot is checking.

My guess is that there’s an issue somewhere in your bot’s code, so I’m going to move this to the appropriate category and perhaps other bot authors can help you figure it out.

If I’ve misinterpreted and your project is showing as down in UptimeRobot, please let me know and we can take a closer look.


#3

but like, there must be some problems, cause when i exit glitch it just shuts down after 10 minutes and i have to go back in, i dont have to restart even, when i open glitch, it just suddenly works, like its not my code because it works when i run it on my pc. Is there no debugging u can do


#5

I’m assuming this is the same project you were discussing before?

We’ll try to take a look as we have time, but I can’t commit to a timeline. The result of that’s likely to be “here are some things you can do to figure out what’s going on”, not “here’s the solution to your problem” but you never know - something may present itself.

If you’d like more eyes on the problem it will be useful for other folks who aren’t Glitch staff (and who know more about writing Discord bots than we do) to be able to see your code.


#6

ok so your gonna post this to everyone


#7

I won’t do that; that’s not for me to decide.

I will suggest that you (at least temporarily) make your project non-private. That will allow others to see your code (but not the contents of your .env file where secrets like bot tokens can be stored). It also won’t allow anyone to edit your code (as noted in the link to the information about private projects in your other thread) unless you explicitly invite them using the invite token.


#9

wait, how do you make the .env file not visible to others, and how do i make it read only


#10

That’s part of how Glitch works - if your project is public then folks will see the file, and the names of the elements in it, but not the values.

As project owner, for example, I see:
image

As a non-project member, I see:
image


#11

ah, but how do i make it read only


#12

Non-project members would have to Remix your project to be able to edit any of the files, including .env.


#13

@cori image it doesnt even refresh


#14

Ok, I don’t see anything super obvious that would be causing your bot to go offline when you disconnect from the project assuming your UptimeRobot config is working correctly (and it wouldn’t have been when you were missing the listener code we discussed in the other thread, because there wouldn’t have been anything for UptimeRobot to connect to to keep it alive without that code). If you want to share a screenshot of your UptimeRobot config we can definitely take a look to make sure it looks correct. The timing of the shutdowns that you’re describing is a little suspicious - it does sound like roughly the time line I’d expect a project to go to sleep if idle.

I do note that your watch.json file seems to be includeing some file types that appear to be being updated by your code - for instance from the contents of Rewind it looks like you code is updating some json files and your watch.json file is telling Glitch to watch those for restarts. I don’t think that’s related to the problem you’re describing, though.

A couple of other things you might try:

  1. you’re trying to catch errors at index.js line 1136. You could switch that to logging to a file so you can go back and review it when the bot shuts down to see if it ran into an error.
  2. you could also try watching the console logs without having the editor open. https://glitch.com/edit/#!/logs-websocket-demo is a poorly-documented and only-lightly-tested approach to attaching to your project’s logs websocket so you can watch them without being in the editor. Logging errors to a file may be a better place to start.

Lastly, I haven’t asked this before, but what’s the behavior that you’re observing that leads you to believe the project is shutting down? Is the bot just dropping off-line? Something else?


#15

like this us starting to become a problem, ive already sent a message like this but nothing happend. Like my bot is serving 41,000 poeple and 63 servers on discord. Its becoming an issue, and i need help. I have it on uptimerobot so it should ping the bot, but it still goes offline. If someone could help, maybe see the project. like it just randomly shuts down, help.

And btw image Which one of these links is it that i copy and paste in uptimerobots html paste in box


#16

Hi @ramoth123 since this latest post is the same question from your other thread, I’ve moved it there.

You’ll want to use the App link for your UptimeRobot config.

Have you looked at any of the things I mentioned here? Can you show us your UptimeRobot config and stats?


#17

Yeah hi @cori , so i basicly have to use this app link and paste it in the URL box in my uptime robot setup
image And i can only post one image so i cant show u my uptime robot setup, but i have the code link on the side og the app link, so ill switch to the app link and see what happends. And with the limit of amount of messages i can send i have to be careful. You should prob make the limi per day more then 15-20 idk. And i probebly cant answer you back after you send a reply to this so…


#18

I assume you’re talking about message limitations in the forum; if so I wouldn’t have expected you to run into anything that’s blocking you yet but feel free to send me a screenshot (you should be able to PM me or the support_staff group by now) and we’ll see if we can get it sorted. Specifically, though, you just got promoted to the next trust level, so some of the image- and reply-based limitations you were previously seeing should now be gone. You should be able to reply with your UptimeRobot config (and include your uptime history, while you’re at it).


#19

Yeah i saw i got basic. But i think i fixed the problem. You know, there used to be 1 share link options but now its 3 options, so thats why it messed up. I’ll be back soon if it doesnt work still


#20

Yep, we talked about that change in More Ways to Share (and more!) sorry if it threw you off!