now.js hosted node app crashes after a while

326 views Asked by At

I'm making bots for discord using discord.js library and I'm hosting them on now.js. However I've had some annoying issues with now.js hosting.

When I try to host the app using now.js alone it crashed before the build is finished after 5mn and prints

No open port found. Make sure 'npm start' creates an HTTP server on a port (any).

So I add http server using npm and create a localhost server on build and I launch my bot at the same time using this npm start command

http-server -p 8000 & node index

When I do that the build works fine, I then scale it to 1 instance that never sleeps and I have no issue. However after a few days the app crashes and prints that

09/05 08:44 PM (5d)
Killed
09/05 08:44 PM (5d)
npm ERR! code ELIFECYCLE
09/05 08:44 PM (5d)
npm ERR! errno 137
09/05 08:44 PM (5d)
npm ERR! [email protected] now-start: `http-server -p 8000 & node index`
09/05 08:44 PM (5d)
npm ERR! Exit status 137
09/05 08:44 PM (5d)
npm ERR! 
09/05 08:44 PM (5d)
npm ERR! Failed at the [email protected] now-start script.
09/05 08:44 PM (5d)
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

From this error I understand that the issue is with the http server getting stopped. And this is a problem because that means I need to restart the app every few days. How can I prevent that?

0

There are 0 answers