iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🚤
Fixing Heroku R10 (Boot timeout) Error
Error Details
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
What I was trying to do
This occurred when I was trying to set up a server using Fastify with Node.js (v16).
The code in this article is specific to Fastify, so please adapt it accordingly if you are using other libraries.
Approaches that didn't fully solve the problem
When searching for the error details, I found articles suggesting to start the server using the PORT environment variable.
So, following that advice:
index.ts
server.listen(process.env.PORT || 8000, (err, address) => {
if (err) throw err
server.log.info(`server listening on ${address}`)
})
However, it still didn't fix the issue...
How I Solved It
In addition to matching the port to PORT, you also need to specify the host as 0.0.0.0.
Therefore, I was able to resolve it by doing the following:
index.ts
server.listen(process.env.PORT || 8000, "0.0.0.0", (err, address) => {
if (err) throw err
server.log.info(`server listening on ${address}`)
})
Summary
If you encounter an R10 error, it might be worth checking if you've forgotten to specify the host.
Discussion