Botkit: 0.4.0 to 0.4.1 Introduced WebServer Issue

Created on 10 Nov 2016  路  6Comments  路  Source: howdyai/botkit

When using the setupWebServer function from the slack button example - https://github.com/howdyai/botkit/blob/master/examples/slackbutton_bot.js I'm getting an error on Heroku saying that it is failing to bind to $PORT. Can we get a fix for this?

My botkits that are running version 0.4.0 will succeed and not crash on the binding part.

2016-11-10T20:21:23.350453+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-11-10T20:21:23.496229+00:00 heroku[web.1]: Process exited with status 137
2016-11-10T20:21:23.498989+00:00 heroku[web.1]: State changed from starting to crashed
2016-11-10T20:21:23.499850+00:00 heroku[web.1]: State changed from crashed to starting
2016-11-10T20:21:26.665760+00:00 heroku[web.1]: Starting process with command node index.js
2016-11-10T20:21:28.940069+00:00 app[web.1]: info: * Using simple storage. Saving data to ./db_slackbutton_bot/
2016-11-10T20:21:28.975754+00:00 app[web.1]: info: *
Setting up custom handlers for processing Slack messages
2016-11-10T20:21:28.976059+00:00 app[web.1]: info: * Configuring app as a Slack App!
2016-11-10T20:21:29.004855+00:00 app[web.1]: info: *
Starting webserver on port 31667
2016-11-10T20:21:29.005157+00:00 app[web.1]: info: * Serving webhook endpoints for Slash commands and outgoing webhooks at: http://127.0.0.1:31667/slack/receive
2016-11-10T20:21:29.006160+00:00 app[web.1]: info: *
Serving login URL: http://127.0.0.1:31667/login
2016-11-10T20:21:29.006386+00:00 app[web.1]: info: ** Serving oauth return endpoint: http://127.0.0.1:31667/oauth
2016-11-10T20:21:23.350453+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-11-10T20:21:23.350453+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-11-10T20:21:23.496229+00:00 heroku[web.1]: Process exited with status 137
2016-11-10T20:21:23.498989+00:00 heroku[web.1]: State changed from starting to crashed

bug web services

Most helpful comment

I had the same issue with Heroku servers -> you should use your process environment PORT VAR and to set your hostname to 0.0.0.0 as for now the default hostname in Botkit is set to 127.0.0.1

All 6 comments

@jonchurch can you confirm your recent change?
https://github.com/howdyai/botkit/commit/00d1ba0228e3305a4bebe5891fe87a2c7f3dd3e3
@TheJimFactor can you try removing that change marked above and see if that fixes your issue?

Hmmm I will try to replicate this when I am back at my computer later tonight.

At first glance, it is likely heroku passes process.env.PORT instead of process.env.port, but my PR isn't a breaking change for that. I would first change lines 30 and 47 to process.env.PORT and see if that fixes it.

FWIW, I'm able to get my own Slash command bot running on 0.4.1 with no code changes. I think this is at worst a bug in the example, not Botkit itself.

I ran into the same issue, heroku expects the default http/express hostname, which is 0.0.0.0, not the default used by botkit, which is 127.0.0.1. #492

Try passing in 0.0.0.0 as the hostname to see if this fixes your issue.
var controller = Botkit.slackbot({ hostname: '0.0.0.0' });

I had the same issue with Heroku servers -> you should use your process environment PORT VAR and to set your hostname to 0.0.0.0 as for now the default hostname in Botkit is set to 127.0.0.1

Thanks for the hostname setting tip, I'll try that out in my next botkit bot.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seriousssam picture seriousssam  路  3Comments

imjul1an picture imjul1an  路  3Comments

JonnyBoy333 picture JonnyBoy333  路  3Comments

abinashmohanty picture abinashmohanty  路  4Comments

simpixelated picture simpixelated  路  3Comments