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: https://glitch.com/~starter-winston. Another alternative might be to catch errors and then use the fs module to write the error to a text file.
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.
@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.