Slack command integration broken in official discourse slack plugin

(Dave McClure) #1

I just updated the slack plugin on our instance to the latest version (compare versions), and it appears the /discourse slack commands are now broken:

Here’s what I see in the logs on our instance:

Started POST "/slack/command" for at 2017-04-08 15:07:59 +0000
Processing by DiscourseSlack::SlackController#command as HTML
  Parameters: {"token"=>"REDACTED", "team_id"=>"REDACTED", "team_domain"=>"mydomain", "channel_id"=>"REDACTED", "channel_name"=>"discourse-test", "user_id"=>"REDACTED", "user_name"=>"someuser", "command"=>"/discourse", "text"=>"help", "response_url"=>""}
Redirected to
Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.0ms)
ActionController::UrlGenerationError (No route matches {:action=>"enter", :controller=>"static"})
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack- `generate'

/cc @vinothkannans @tgxworld

(Alan Tan) #2

Is your forum a private forum?

(Dave McClure) #3

yes, it is a private forum

(Vinoth Kannan) #4

@tgxworld We should skip before_filter redirect_to_login_if_required here?

(Alan Tan) #5

Yup I think I removed one of the monkey patches. For the /command path, we need to skip everything because the only authentication we need to do is to check if the Slack token is valid.

(Dave McClure) #6

my understanding of @vinothkannans suggestion appears to work in a quick test. I’ll let you do what makes the most sense rather than PR it, though.

(David Taylor) #7

This is exactly what I’ve done in my Telegram plugin (which is very similar to slack in the way the webhooks work). If there’s a better solution I’d be interested to know!

(Alan Tan) #8

Thanks for reporting @mcwumbly. I’ve fixed it in

and added a test case for it. I’ve been involved in refactoring of the plugin but without existing test cases, there is a higher chance of me breaking stuff without knowing. Feel free to report any more bugs that you come across and I’ll get them sorted.

(Alan Tan) #9