Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

slack_botkit not defined in middleware #307

Closed
supermacro opened this issue Jul 5, 2016 · 3 comments
Closed

slack_botkit not defined in middleware #307

supermacro opened this issue Jul 5, 2016 · 3 comments

Comments

@supermacro
Copy link

supermacro commented Jul 5, 2016

Using Botkit 0.2.2 on Mac OSX el Capitan

My server throws a ReferenceError when trying to do custom slash commands.

The error points to slack_authentication.js where there is no reference made to slack_botkit

slack_botkit.log(
            '** Requiring token authentication for webhook endpoints for Slash commands ' +
            'and outgoing webhooks; configured ' + tokens.length + ' tokens'
        );
@frm
Copy link

frm commented Jul 14, 2016

+1 on outgoing webhooks.

var controller = Botkit.slackbot(config);
var bot = controller.spawn({
  incoming_webhook: {
    url: process.env.INCOMING_WEBHOOK_URL
  }
});

controller.setupWebserver(process.env.PORT, function(err, express_webserver) {
  controller.createWebhookEndpoints(express_webserver,
      [process.env.OUTGOING_WEBHOOK_TOKEN]);
});

At this point, it gives the same ReferenceError:

ReferenceError: slack_botkit is not defined
    at authenticate (/path/to/project/node_modules/botkit/lib/middleware/slack_authentication.js:39:9)
    at Layer.handle [as handle_request] (/path/to/project/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/path/to/project/node_modules/express/lib/router/index.js:312:13)
    at /path/to/project/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/path/to/project/node_modules/express/lib/router/index.js:330:12)
    at next (/path/to/project/node_modules/express/lib/router/index.js:271:10)
    at serveStatic (/path/to/project/node_modules/serve-static/index.js:75:16)
    at Layer.handle [as handle_request] (/path/to/project/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/path/to/project/node_modules/express/lib/router/index.js:312:13)
    at /path/to/project/node_modules/express/lib/router/index.js:280:7

Downgrading to 0.2.1 seems to fix the issue.

sundeepgupta added a commit to sundeepgupta/botkit that referenced this issue Jul 17, 2016
howdyai#307

There is logging happening here which introduces a reference error on `slack_botkit`. Removed this logging code because it already happens in SlackBot.js.
@sundeepgupta
Copy link
Contributor

BTW downgrading to 0.2.1 will break the token check when the slash command POST comes in to your server.

@peterswimm
Copy link
Contributor

PR related to this issue has been released.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants