Keystone-classic: Heroku Deployment - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Created on 13 Feb 2017  ·  31Comments  ·  Source: keystonejs/keystone-classic

Steps to reproduce the behavior

Brand new heroku instance.
Deploy to heroku git push heroku master.

Expected behavior

Application starts and binds to process.env.PORT

Actual behavior

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch. I am debugging process.env and it does have PORT set:

heroku/web.1:  State changed from crashed to starting 
heroku/web.1:  Starting process with command `node keystone.js`
app/web.1:  env ---> { WEB_MEMORY: '512', 
app/web.1:    MEMORY_AVAILABLE: '512', 
app/web.1:    CLOUDINARY_URL: 'cloudinary://...', 
app/web.1:    DYNO: 'web.1', 
app/web.1:    PAPERTRAIL_API_TOKEN: '...', 
app/web.1:    PATH: '/app/.heroku/node/bin:/app/.heroku/yarn/bin:/usr/local/bin:/usr/bin:/bin:/app/bin:/app/node_modules/.bin', 
app/web.1:    WEB_CONCURRENCY: '1', 
app/web.1:    PWD: '/app', 
app/web.1:    MONGOLAB_URI: 'mongodb://...', 
app/web.1:    NODE_ENV: 'production', 
app/web.1:    PS1: '\\[\\033[01;34m\\]\\w\\[\\033[00m\\] \\[\\033[01;32m\\]$ \\[\\033[00m\\]', 
app/web.1:    SHLVL: '1', 
app/web.1:    HOME: '/app', 
app/web.1:    COOKIE_SECRET: '...', 
app/web.1:    PORT: '43760', 
app/web.1:    NODE_HOME: '/app/.heroku/node', 
app/web.1:    _: '/app/.heroku/node/bin/node' } 
heroku/web.1: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
heroku/web.1:  Stopping process with SIGKILL 
heroku/web.1:  State changed from starting to crashed 
heroku/web.1:  Process exited with status 137 

Most helpful comment

Found the issue! I removed this from my package.json

"engines": {
    "node": ">=0.10.22",
    "npm": ">=1.3.14"
  },

When Heroku uses the default node version, it works perfectly!

All 31 comments

Can you show your Procfile please?

And can you confirm how long your application takes to boot in your development environment?

@bassjacob Procfile current looks like this: web: node keystone.js but i have also tried web: node keystone.js -p $PORT. Locally, it starts within 5 seconds.

Heroku dynamically assigns your app a port, so you can't set the port to a fixed number which it looks like your doing at PORT: '43760'.

@akopcz2 I know this behaviour already. My problem is that Keystone is not binding to the port Heroku is setting. As you can see from my logs in my original post that Heroku is setting a port but Keystone isnt starting.

without seeing more information from the repository, this is going to be hard to debug. Have you raised this with Heroku?

Found the issue! I removed this from my package.json

"engines": {
    "node": ">=0.10.22",
    "npm": ">=1.3.14"
  },

When Heroku uses the default node version, it works perfectly!

ah, that's great to hear :smile: Thanks for reporting back.

Just has two sites that encountered the same issue after working for months, then having to do a hotfix today, the above error was encountered. Removing the "engines" from the package.json allowed the app to start without error.

I've pushed a fix that removes engines from the package.json, which will hopefully resolve this for good.

@JedWatson I'm not sure in which project you removed it but the keystone starter has still those lines. Removing them makes Heroku work

The below steps resolved my solution:

Editing package.json as:

...
"engines": {
"node": "5.0.0",
"npm": "4.6.1"
},
...

and Server.js as:

...
var port = process.env.PORT || 3000;
app.listen(port, "0.0.0.0", function() {
console.log("Listening on Port 3000");
});
...

I have this problem too, but in Python web app.

2018-02-28T21:28:48.310949+00:00 heroku[web.1]: - Starting process with command 'python bot.py`
2018-02-28T21:29:48.530267+00:00 heroku[web.1]: - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-02-28T21:29:48.530693+00:00 heroku[web.1]: - Stopping process with SIGKILL
2018-02-28T21:29:48.642700+00:00 heroku[web.1]: - Process exited with status 137
2018-02-28T21:29:48.715887+00:00 heroku[web.1]: - State changed from starting to crashed
2018-02-28T21:29:48.718579+00:00 heroku[web.1]: - State changed from crashed to starting
2018-02-28T21:29:52.041685+00:00 heroku[web.1]: - Starting process with command `python bot.py`
2018-02-28T21:30:52.547883+00:00 heroku[web.1]: - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-02-28T21:30:52.547980+00:00 heroku[web.1]: - Stopping process with SIGKILL
2018-02-28T21:30:52.626431+00:00 heroku[web.1]: - Process exited with status 137
2018-02-28T21:30:52.767157+00:00 heroku[web.1]: - State changed from starting to crashed

How to fix this? It's a telegram bot, it only works for a minute.
UPD Yes, I know that this is a js repository, I just did not find any more information about this error. Thank you in advance

@frozyeah i have equal problem but in java project(jar executable).Have you Any solutions? Thanks

@MetaNaveen , guy, thanks a lot. especially for the second part of your decision (server-side) it helped me

@frozyeah have you fixed your peoblem? I have exactly the same error, first time i launched the app everything was good, but on second start I have same error
State changed from crashed to starting
Starting process with command python PythonBotEcho.py
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Stopping process with SIGKILL
State changed from starting to crashed
Process exited with status 137

@anakib1 This GitHub issue queue is for bugs or feature suggestions related to the Keystone JS Framework.

If you have general questions on using Heroku, please try Heroku Support resources or post a question on Stack Overflow with details relevant to your question.

Thanks,
Stennie

This happened to me when i write a static hard coded port number.
using process.env.PORT || 3000; to be listened solve the exact error.

Maybe you need change web: filename.py to app: filename.py if it's telegram bot

Thanks to everyone. @bogi7up your solution helped.

I am still sufferring from the same issue,
Web process failed to bind within 60 seconds of launch.
I have applied all fixes mentioned above.
Please guide me

@sakshi30 Need more details.

I was trying to deploy a mean stack project on heroku. In my server I am listening to process.env.PORT || 3000; dynamically. My mongodb is also deployed with mlab. Still I am facing the issue Web process failed to bind $port within 60 seconds of launch. and app crashes.

I too am experiencing this same issue in 2018. Any help?

I've experienced this, too. You can send a support ticket to Heroku asking for more startup time. They will add another 30 seconds for you.

I solved the problem by changing the Procfile.

change web _to_ worker

and then, if it do not work, on the heroku cli type the following:
$ heroku scale web=0 worker=1

When deploying an application that uses webpack to heroku, I got the same error and my solution was:

  • I changed my server.js to include this code
var express = require('express');
var app = express();
var path = require('path');


app.use(express.static(__dirname + '/'));
app.get('*', (req, res) =>{
    res.sendFile(path.resolve(__dirname, './src/index.html'));
});
app.listen(process.env.PORT || 8080);
  • Then added a Procfile with the following code
web: node server.js

This simply tells heroku which port to use and also which command to use when starting the server remotely. Since, you know, when heroku starts the server using npm start, it automatically listens to the default port. Therefore when you specify in Procfile the command to start the server, heroku will use the port you specify.

Hi folks,

I had this issue and fixed it. It's a binding error between keystone server and heroku configuration. It means that you're not listening with heroku on the right port or the right host.

In my case, I had to set the host on 0.0.0.0 and not 127.0.0.1 as recommended on heroku support.
Here is the link regarding a r10 error : heroku Error R10 help .

Hope it will save you 3 hours of productivity.

Thank @AlanFonderflick
This was my code before
const PORT = 3000;

and I changed it to
const PORT = process.env.PORT || 3000;

Yuhuuuu. it worked. Thanks for saving 3 hours of productivity. :)

Thank @AlanFonderflick
This was my code before
const PORT = 3000;

and I changed it to
const PORT = process.env.PORT || 3000;

Yuhuuuu. it worked. Thanks for saving 3 hours of productivity. :)

Thank you, you save my life

what do you put tin the .ENV file

Was this page helpful?
0 / 5 - 0 ratings