How do I place a Node application on Heroku that runs full-time and is not an api?

Asked

Viewed 30 times

1

Objective: to run Puppeteer on Heroku for at least 8 hours a day, without interruptions.

I have a simple program on Puppeteer, it basically operates some accounts on websites and that’s it. That’s it. Does not return value, or use database, or create ports. The maximum is a request to an external api via Xios.

During the run I went through some boring problems: browser not wanting to start, Node packages missing, and so on. Nothing too complicated.

Finally, I had two problems:

  • Using "web: Node index.js" in Procfile without express
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Stopping process with SIGKILL  
Process exited with status 137  
State changed from starting to crashed

  • Using the same web command, but with express:

    The addition of code

const app = express()

app.get('/', function (req, res) {
    res.send("it's working")
})

app.listen(process.env.PORT || 3000)

    The mistake

Idling 
State changed from up to down
Stopping all processes with SIGTERM
Error R12 (Exit timeout) -> At least one process failed to exit within 30 seconds of SIGTERM
Stopping remaining processes with SIGKILL
Process exited with status 137       
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.