2

I have a worker process running on Heroku for a bot I made for Slack using Botkit and Node.js. (There is just one worker and no web processes.) When users authenticate with my app, they need to be redirected. My Heroku app is called "updooter2" which has the default domain of "https://updooter2.herokuapp.com/". In my app's settings on Slack, the redirect URI is listed as "https://updooter2.herokuapp.com/". I send a user through the OAuth flow using the link provided by Slack:

https://slack.com/oauth/authorize?client_id=xxxxxxxxx&scope=bot,reactions:write,groups:history,channels:history,channels:read

This link redirects them to "https://updooter2.herokuapp.com/" as expected. However, the webpage cannot be displayed and the authentication fails. In my app logs, I have the following:

2018-08-28T01:10:01.227047+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/?code=9428472352.424451020901.a0e68d7f7443a71bfe6e0786ee6e358c6fe7bf1932dadf70be295c8f76b8763f&state=" host=updooter2.herokuapp.com request_id=b33d5c47-9e91-4e5f-8ebe-7a6bd73027e4 fwd="169.145.120.131" dyno= connect= service= status=503 bytes= protocol=https

2018-08-28T01:10:01.650177+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=updooter2.herokuapp.com request_id=9a49db8c-5d0a-4f7f-8c95-e94562abe20f fwd="169.145.120.131" dyno= connect= service= status=503 bytes= protocol=https

How can I authenticate users of my app in this situation, ideally keeping the number of processes to just the worker? Thanks!

Hannah
  • 23
  • 3

1 Answers1

0

The redirect url should be something like: https://updooter2.herokuapp.com/oauth

Take a look: https://botkit.ai/docs/provisioning/slack-events-api.html

If you follow this guide, and then visit your app you should receive an install link that works to add the bot on your slack team. You might also want to make sure you are using the Heroku deploy link from the starter kit: https://github.com/howdyai/botkit-starter-slack#getting-started

it should just work if you use this path.

Peter Swimm
  • 111
  • 1
  • 4
  • I tried that redirect URL but I get the error "An error occurred in the application and your page could not be served." when I navigate to that page, or any URL that begins with [link](https://updooter2.herokuapp.com). I tried the heroku deploy link here [link](https://github.com/howdyai/botkit-starter-slack#getting-started) as well, but had the same issue. I think that needs updating; it sets the config vars to clientId, clientSecret, etc. but the actual code expects CLIENT_ID, CLIENT_SECRET – Hannah Aug 28 '18 at 16:44
  • Unfortunately it doesn't. – Hannah Aug 29 '18 at 20:15
  • 1
    I think the problem is, that your bot is running on a worker, but a worker does not have any public available URL you can call. So you need a webserver running on a dyno and then... thats our problem. We are not able to route the requests to the worker, so currently we run the webserver+botkit on a heroku dyno. – Simon Franzen Aug 29 '18 at 23:08
  • I was running it as a worker process since it would crash sometimes when running it as a web process, but I changed it back to a web process and seems to be working for now. However, I get the error "Cannot GET /" when I try to go to https://updooter2.herokuapp.com/. Do I need to have a webpage in order to have this work? The RTM messaging API is also not connecting. – Hannah Aug 31 '18 at 20:49
  • 2
    Update: I upgraded to a Hobby web dyno instead of using the free one and it's working now! – Hannah Sep 01 '18 at 17:25