stripe-contrib / pagerbot

Manage Pagerduty on-call schedules from within your internal chat channels.
https://stripe.com/blog/pagerbot
MIT License
277 stars 90 forks source link

Slack Bot won't come online #53

Open geekdave opened 7 years ago

geekdave commented 7 years ago

Thanks so much for this project! Looks like exactly what my team needs.

This might be a n00b kind of problem, but I'm unable to get my Slackbot to come online.

I used the Heroku install. Here's what I did so far:

Set up PagerDuty:

pagerbot_admin

Set up Slack:

pagerbot_admin

Set up plugins (I only enabled the ones that didn't require inputs for now):

pagerbot_admin

Deployed by switching off the web app and switching on the bot app.

I can see the bot in Slack but it won't come online:

slack_-_walmart_labs

Here are the logs when I start up the bot:

Feb 09 08:58:01 test-pagerbot heroku/router:  at=error code=H14 desc="No web processes running" method=GET path="/api/bot" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:02 test-pagerbot heroku/router:  at=error code=H14 desc="No web processes running" method=GET path="/views/bot.html" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:07 test-pagerbot heroku/router:  at=error code=H14 desc="No web processes running" method=GET path="/" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:16 test-pagerbot app/api:  Scaled to bot@1:Free console@0:Free rake@0:Free web@1:Free by user dcadwallader@gmail.com 
Feb 09 08:58:17 test-pagerbot heroku/bot.1:  State changed from crashed to down 
Feb 09 08:58:18 test-pagerbot app/api:  Scaled to bot@0:Free console@0:Free rake@0:Free web@1:Free by user dcadwallader@gmail.com 
Feb 09 08:58:18 test-pagerbot heroku/web.1:  Starting process with command `bundle exec ruby lib/pagerbot.rb web` 
Feb 09 08:58:20 test-pagerbot app/web.1:  fatal: Not a git repository (or any parent up to mount point /app) 
Feb 09 08:58:20 test-pagerbot app/web.1:  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). 
Feb 09 08:58:21 test-pagerbot app/web.1:  2017-02-09 16:58:20.898531 I [4:70187052317060] PagerBot -- Starting application -- {:is_admin=>true, :argv=>["web"]} 
Feb 09 08:58:21 test-pagerbot app/web.1:  == Sinatra (v1.4.8) has taken the stage on 56160 for production with backup from Thin 
Feb 09 08:58:21 test-pagerbot heroku/web.1:  State changed from starting to up 
Feb 09 08:58:22 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:22 +0000] "GET / HTTP/1.1" 200 3634 0.0066 
Feb 09 08:58:22 test-pagerbot heroku/router:  at=info method=GET path="/" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:22 test-pagerbot heroku/router:  at=info method=GET path="/api/bot" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:23 test-pagerbot heroku/router:  at=info method=GET path="/views/bot.html" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:23 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:22 +0000] "GET /views/bot.html HTTP/1.1" 200 5226 0.0016 
Feb 09 08:58:23 test-pagerbot heroku/router:  at=info method=GET path="/api/bot" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:23 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:22 +0000] "GET /api/bot HTTP/1.1" 200 225 0.0421 
Feb 09 08:58:23 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:22 +0000] "GET /api/bot HTTP/1.1" 200 225 0.0289 
Feb 09 08:58:23 test-pagerbot heroku/router:  at=info method=GET path="/api/pagerduty" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:23 test-pagerbot app/web.1:  2017-02-09 16:58:23.123269 I [4:70187065891660] (592.9ms) PagerBot::AdminPage -- Checking pagerduty connectivity. 
Feb 09 08:58:23 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:23 +0000] "GET /api/pagerduty HTTP/1.1" 200 93 0.6625 
Feb 09 08:58:27 test-pagerbot heroku/router:  at=info method=POST path="/api/bot" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:28 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:27 +0000] "POST /api/bot HTTP/1.1" 200 235 0.0285 
Feb 09 08:58:30 test-pagerbot heroku/router:  at=info method=GET path="/api/plugins" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:30 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:30 +0000] "GET /api/plugins HTTP/1.1" 200 1994 0.0637 
Feb 09 08:58:33 test-pagerbot heroku/router:  at=info method=GET path="/api/users" host=xxxxxxxxxx.herokuapp.com request_id=xxxxxxxxxxxxxxxx
Feb 09 08:58:33 test-pagerbot app/web.1:  2017-02-09 16:58:32.930503 I [4:70187065890220] (533.7ms) PagerBot::DataStore -- Fetching collection from pagerduty. 
Feb 09 08:58:33 test-pagerbot app/web.1:  2017-02-09 16:58:32.930681 I [4:70187065890220] PagerBot::DataStore -- Added to users: [] 
Feb 09 08:58:33 test-pagerbot app/web.1:  2017-02-09 16:58:32.932656 I [4:70187065890220] PagerBot::DataStore -- Removed from users: [] 
Feb 09 08:58:33 test-pagerbot app/web.1:  2017-02-09 16:58:32.937218 I [4:70187065890220] PagerBot::DataStore -- Refreshed collection. -- {:collection_name=>"users", :total=>8, :added=>0, :removed=>0} 
Feb 09 08:58:33 test-pagerbot app/web.1:  216.207.42.140 - - [09/Feb/2017:16:58:32 +0000] "GET /api/users HTTP/1.1" 200 10615 0.5806 
Feb 09 08:59:10 test-pagerbot app/api:  Scaled to bot@1:Free console@0:Free rake@0:Free web@1:Free by user dcadwallader@gmail.com 
Feb 09 08:59:12 test-pagerbot heroku/bot.1:  Starting process with command `bundle exec ruby lib/pagerbot.rb` 
Feb 09 08:59:13 test-pagerbot heroku/bot.1:  State changed from starting to up 
Feb 09 08:59:15 test-pagerbot app/bot.1:  fatal: Not a git repository (or any parent up to mount point /app) 
Feb 09 08:59:15 test-pagerbot app/bot.1:  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). 
Feb 09 08:59:16 test-pagerbot app/bot.1:  2017-02-09 16:59:15.911067 I [4:70183564769660] PagerBot -- Starting application -- {:is_admin=>false, :argv=>[]} 
Feb 09 08:59:16 test-pagerbot app/bot.1:  2017-02-09 16:59:15.988586 I [4:70183564769660] PagerBot::PluginManager -- Loading plugin. -- {:name=>"add_alias", :class=>"PagerBot::Plugins::AddAlias", :config=>{}} 
Feb 09 08:59:16 test-pagerbot app/bot.1:  2017-02-09 16:59:15.989743 I [4:70183564769660] PagerBot::PluginManager -- Loading plugin. -- {:name=>"reload", :class=>"PagerBot::Plugins::Reload", :config=>{}} 
Feb 09 08:59:16 test-pagerbot app/bot.1:  2017-02-09 16:59:15.990276 I [4:70183564769660] PagerBot::PluginManager -- Loading plugin. -- {:name=>"schedule_override", :class=>"PagerBot::Plugins::ScheduleOverride", :config=>{}} 
Feb 09 08:59:16 test-pagerbot app/bot.1:  2017-02-09 16:59:15.991089 I [4:70183564769660] PagerBot::PluginManager -- Loading plugin. -- {:name=>"switch_shift", :class=>"PagerBot::Plugins::SwitchShift", :config=>{}} 
Feb 09 08:59:23 test-pagerbot app/bot.1:  W, [2017-02-09T16:59:22.459558 #4]  WARN -- : You are setting a key that conflicts with a built-in method Slack::Messages::Message#presence defined at /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.7.8/lib/slack/messages/message.rb:4. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method. 
Feb 09 08:59:23 test-pagerbot app/bot.1:  W, [2017-02-09T16:59:22.463755 #4]  WARN -- : You are setting a key that conflicts with a built-in method Slack::Messages::Message#presence defined at /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.7.8/lib/slack/messages/message.rb:4. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method. 
Feb 09 08:59:23 test-pagerbot app/bot.1:  W, [2017-02-09T16:59:22.466233 #4]  WARN -- : You are setting a key that conflicts with a built-in method Slack::Messages::Message#presence defined at /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.7.8/lib/slack/messages/message.rb:4. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method. 
Feb 09 08:59:23 test-pagerbot app/bot.1:  W, [2017-02-09T16:59:22.538811 #4]  WARN -- : You are setting a key that conflicts with a built-in method Slack::Messages::Message#presence defined at /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.7.8/lib/slack/messages/message.rb:4. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method. 
Feb 09 08:59:23 test-pagerbot app/bot.1:  W, [2017-02-09T16:59:22.540161 #4]  WARN -- : You are setting a key that conflicts with a built-in method Slack::Messages::Message#presence defined at /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.7.8/lib/slack/messages/message.rb:4. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method. 
Feb 09 08:59:23 test-pagerbot app/bot.1:  W, [2017-02-09T16:59:22.542076 #4]  WARN -- : You are setting a key that conflicts with a built-in method Slack::Messages::Message#presence defined at /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.7.8/lib/slack/messages/message.rb:4. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.

Hopefully I'm just doing something silly. Thanks again for your work on this!

macobo commented 7 years ago

Is the bot marked online? If so, you need to invite it to the channel.

I'm planning on revamping the deploy documentation and was planning on adding these instructions then. Sorry for the trouble in the internim!

EDIT: Oh, I see you tried PMing the bot. That strikes that theory. Gonna try deploying and seeing if I can find something.

geekdave commented 7 years ago

@macobo Thanks for the response! The bot never gets marked online. I've tried both DMing the bot and inviting it to a channel, but since it never comes online I am unsure what the problem is. Anything look suspicious in the logs or screenshots? Thanks again!

macobo commented 7 years ago

Alternatively, I just pushed a few commits that add a bit of logging on connect/disconnect, would appreciate if you could test with that.

Unfortunately there isn't a good update mechanism with heroku button apps though normal heroku deploys would help, as would deleting and recreating the app.

geekdave commented 7 years ago

Hey @macobo - Thanks for the tips. I cloned the repo just now, and installed via the heroku command line. I don't seem to see any of the new logging, and the Slack warnings are still there as well :(

Feb 09 11:53:50 cryptic-dusk-50242 app/bot.1:  2017-02-09 19:53:50.697433 I [4:70136728484220] PagerBot -- Starting application -- {:is_admin=>false, :argv=>[]} 
Feb 09 11:53:51 cryptic-dusk-50242 app/bot.1:  2017-02-09 19:53:50.752317 I [4:70136728484220] PagerBot::PluginManager -- Loading plugin. -- {:name=>"add_alias", :class=>"PagerBot::Plugins::AddAlias", :config=>{}} 
Feb 09 11:53:51 cryptic-dusk-50242 app/bot.1:  2017-02-09 19:53:50.753174 I [4:70136728484220] PagerBot::PluginManager -- Loading plugin. -- {:name=>"reload", :class=>"PagerBot::Plugins::Reload", :config=>{}} 
Feb 09 11:53:51 cryptic-dusk-50242 app/bot.1:  2017-02-09 19:53:50.753552 I [4:70136728484220] PagerBot::PluginManager -- Loading plugin. -- {:name=>"schedule_override", :class=>"PagerBot::Plugins::ScheduleOverride", :config=>{}} 
Feb 09 11:53:51 cryptic-dusk-50242 app/bot.1:  2017-02-09 19:53:50.754454 I [4:70136728484220] PagerBot::PluginManager -- Loading plugin. -- {:name=>"switch_shift", :class=>"PagerBot::Plugins::SwitchShift", :config=>{}} 
Feb 09 11:53:57 cryptic-dusk-50242 app/bot.1:  W, [2017-02-09T19:53:57.171772 #4]  WARN -- : You are setting a key that conflicts with a built-in method Slack::Messages::Message#presence defined at /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.7.8/lib/slack/messages/message.rb:4. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method. 

I do have your latest commits so I'm not sure what's up. Just sent you a hangout invite as well.

geekdave commented 7 years ago

The root cause seems to be in: https://github.com/slack-ruby/slack-ruby-client/issues/134