Naltox / telegram-node-bot

Node module for creating Telegram bots.
MIT License
721 stars 143 forks source link

Web process failed to bind to $PORT within 60 seconds of launch #119

Closed rmnblm closed 7 years ago

rmnblm commented 7 years ago

When I deploy a Telegram bot built with this module to Heroku, after 60 seconds I get following error:

2016-09-20T11:50:11.599886+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-09-20T11:50:11.599886+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-09-20T11:50:11.705966+00:00 heroku[web.1]: Process exited with status 137

I couldn't find a way to set a port because there is no .listen(...) method when calling the Telegram constructor. Any ideas?

rmnblm commented 7 years ago

Might be resolved with PR https://github.com/Naltox/telegram-node-bot/pull/98

rmnblm commented 7 years ago

I solved the problem by using a Procfile with the following content:

worker: node index.js

I did also run the following command

$ heroku scale web=0 worker=1
vincentaudebert commented 6 years ago

Watch out. This doesn't work on a free dyno.

MetaNaveen commented 6 years ago

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"); }); ...

johnKHill commented 6 years ago

Thank you. This worked for me 100%.

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

rajanbhadauria commented 6 years ago

var express = require('express'); var path = require('path'); var app = express();

global.appRoot = path.resolve(__dirname);

var port = process.env.PORT | 8000;

app.use(express.static(appRoot + '/public/dist'));

app.listen(port, '0.0.0.0', function() { console.log("Listening on Port "+port); });

I have the same issue but not able to fix it Please help me to fix it

johnKHill commented 5 years ago

It didn't

On Fri, Dec 14, 2018, 9:52 PM MonX94 <notifications@github.com wrote:

Watch out. This doesn't work on a free dyno.

It did.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Naltox/telegram-node-bot/issues/119#issuecomment-447531471, or mute the thread https://github.com/notifications/unsubscribe-auth/AZgoHokQMy7pSdHkyXTq91j1O9svtvVQks5u5GPQgaJpZM4KBiNN .

misterdev commented 4 years ago

@vincentaudebert do you know the reason why that doesn't work on free dynos?