tovleeuw
tovleeuw

Reputation: 31

Bolt-js in socket mode on heroku fails with Error R10

I have a slack bolt-js server app that runs with socketMode: true It works perfectly fine on my local pc, but when moving it to Heroku in a web dyno, it fails after 1 min. It starts up just fine and it is fully functional during that minute, but after 1 min I get this

2021-09-01T12:59:33.771745+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

My bolt-js app is started like this:

await app.start(process.env.PORT);

I think Heroku is failing to detect that there is a websocket on this port open and then times out.

I went through a lot of documentation already. I must say that the bolt-js documentation is conflicting with Heroku's. They suggest I use a worker dyno, but Heroku says explicitly that worker dynos cannot receive web HTTP traffic.

Totally at a loss here. Any ideas anybody?

Upvotes: 3

Views: 719

Answers (2)

omkar p
omkar p

Reputation: 63

This question is posted far log ago but may be this help to anyone. you can add port in app configuration like

const {App} = require('@slack/bolt');
const app = new App({
    token:process.env.bot_token,
    port: process.env.PORT || 3000,
});
(async()=>{
await app.start();
})

may be this help to you.

Upvotes: 0

hi-im-b
hi-im-b

Reputation: 113

I ran into this just a few days ago, I found that changing the dyno type on Heroku from web to worker solved this issue. The idea came from this page, specifically the Dyno configurations section.

To change the dyno type, navigate to the Resources section of your Heroku app, you should see something like the following: Resources Tab

From there you want to edit the web type and toggle it off -- do the same for the worker type and toggle it on. The dyno automatically restarts so you should be able to view the logs immediately.

Upvotes: 8

Related Questions