Project in status AFK | Discord Bot on DJS 11.6.2

Good afternoon! I want to see a Glitch technical support answer. Why the project does process.exit () without the user’s knowledge and after these actions it no longer works until the owner goes into the code editor.

P.S. As I understand it, the problem is in Glitch. When I go into the project console (where the logs are kept) it is empty despite the fact that there should be an error due to which the bot crashed.

@xyligan, when process.exit() happens, Glitch automatically restarts your project and then continues to execute npm start. process.exit() can happen due to packages that you’re using that might throw an error and exit the process manually. process.exit() shouldn’t have an effect on your project unless it happens as soon as the execution of the code begins and this process loops over and over again.

Logs aren’t persistent, meaning they are not saved, and hence, you might not see the logs in the editor. So far, a way to store logs hasn’t been found, but you can use a logger package like Winston which logs to an external .log file which you can view whenver you like. However, Winston might not be able to log errors caused by code and packages and can only log content that is manually asked to log. See an example of Winston on Glitch by @jenn: Another alternative might be to catch errors and then use the fs module to write the error to a text file.

1 Like

What kind of nonsense related to packages? Not one of me has such a project flies. That is, all packages have the wrong ones?
Well, then explain why the delay / ping bot rises?
First, for example, 17-20 ms., And then 1020 ms. and higher.

You can ping the project with the Uptimerobot site

1 Like

UptimeRobot - complete nonsense. Why do I need it if I have my own server, which pings once every half a minute.

My packages:
“dependencies”: {
“discord.js”: “^11.6.2”,
“express”: “^4.17.1”,
“simple-youtube-api”: “^5.2.1”,
“sqlite3”: “^4.2.0”,
“util”: “^0.12.3”,
“ytdl-core”: “^2.1.2”,
“quick.db”: “^7.1.1”,
“hastebin-gen”: “^2.0.5”,
“strftime”: “^0.10.0”,
“bfdapi.js”: “^2.0.0”,
“request-promise-native”: “^1.0.8”,
“node-opus”: “^0.3.3”,
“opusscript”: “^0.0.7”,
“request”: “^2.88.2”,
“mysql2”: “^2.1.0”

Packages here refer to npm packages. I was merely saying that some packages process.exit() whever you encounter an error.

1 Like

Now many people are using the uptimerobot site and I am using it so far I had no problems.

1 Like

The problem is not in sites for projects, but in Glitch itself.

Already everything that could be done, did. But the project vseravno crashes on its own without any errors.

@xyligan Ello, so, first, the bot ping is most likely rising because of high amounts of traffic flowing in and out of the discord api gateways, second of all, uptime robot pings your project every 5 minutes, so it stays awake, and does not shut down. 3rd, the high ping can also have a bit of an origin in the amount of cache being built up quickly by all the packages you have installed. 4th, ( almost forgot ), packages should not have a process.exit() call in their code, if it does, it could damage a lot, and it is best to look for alternatives. if you call process.exit() in the code you wrote, it is best to replace it with a return statement ( when in a function ), or to just delete it as it serves no purpose but to cause the process to stop.