Why is my Node process taking so long to start?


When running the boot process for an app, there's a lag for a significant amount of time (anything over than 1 second) between the time the dyno is started or restarted and the time the process is started.


It's most likely that modifications to the node binary is causing latency to running the process. In order to see what is happening, we can run Node in debug mode by using NODE_DEBUG=*, which will output the logs for the steps node takes to run a process.

This can be executed in a one-off dyno of the app:

heroku run bash -a APP_NAME
// one-off dyno booted
~ $ NODE_DEBUG=* node index.js

Or it can be used in the package.json run script:

"npm start": "NODE_DEBUG=* node index.js"

Or in the Procfile:

web: NODE_DEBUG=* node index.js

After running this, there will be logs from node.

Alternatively, Express also has a debug mode that is similar and documented here: https://expressjs.com/en/guide/debugging.html. It can be used the same way by including DEBUG=express:* in the Node start/web process.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support