Issue
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.
Resolution
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.