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

TypeError when Slack slash command received by bot #1447

Closed
sprak3000 opened this issue Aug 20, 2018 · 1 comment
Closed

TypeError when Slack slash command received by bot #1447

sprak3000 opened this issue Aug 20, 2018 · 1 comment

Comments

@sprak3000
Copy link

  • botkit version v0.6.16
  • Ubuntu 16.04.5 LTS
  • Bot connected to Slack

Had not updated my version of botkit for some time and recently upgraded to v0.6.16. Had a working slash command prior to the upgrade. After the upgrade, sending the slash command results in this error output in the server log:

TypeError: Cannot read property 'user_id' of undefined
    at /home/ubuntu/shodan/node_modules/botkit/lib/SlackBot.js:258:34
    at /home/ubuntu/shodan/node_modules/botkit/lib/SlackBot.js:149:17
    at Store._get (/home/ubuntu/shodan/node_modules/botkit/node_modules/jfs/Store.js:198:39)
    at Store.get (/home/ubuntu/shodan/node_modules/botkit/node_modules/jfs/Store.js:351:12)
    at Object.get (/home/ubuntu/shodan/node_modules/botkit/lib/storage/simple_storage.js:54:26)
    at Object.Slackbot.slack_botkit.findTeamById (/home/ubuntu/shodan/node_modules/botkit/lib/SlackBot.js:543:36)
    at Object.Slackbot.slack_botkit.findAppropriateTeam (/home/ubuntu/shodan/node_modules/botkit/lib/SlackBot.js:147:22)
    at Object.Slackbot.slack_botkit.handleWebhookPayload (/home/ubuntu/shodan/node_modules/botkit/lib/SlackBot.js:226:22)
    at /home/ubuntu/shodan/node_modules/botkit/lib/SlackBot.js:136:26
    at Layer.handle [as handle_request] (/home/ubuntu/shodan/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/ubuntu/shodan/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/ubuntu/shodan/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/ubuntu/shodan/node_modules/express/lib/router/layer.js:95:5)
    at /home/ubuntu/shodan/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/ubuntu/shodan/node_modules/express/lib/router/index.js:335:12)
    at next (/home/ubuntu/shodan/node_modules/express/lib/router/index.js:275:10)
    at serveStatic (/home/ubuntu/shodan/node_modules/express/node_modules/serve-static/index.js:75:16)
    at Layer.handle [as handle_request] (/home/ubuntu/shodan/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/ubuntu/shodan/node_modules/express/lib/router/index.js:317:13)
    at /home/ubuntu/shodan/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/ubuntu/shodan/node_modules/express/lib/router/index.js:335:12)
    at next (/home/ubuntu/shodan/node_modules/express/lib/router/index.js:275:10)

Added some logging to see if something within the slash command handling code was causing this, but it does not seem to even enter into the handler.

Controller setup:

    controller = Botkit.slackbot({
        debug: config.get('botkit.debug'),
        logLevel: config.get('botkit.logLevel'),
        json_file_store: config.get('botkit.jsonFileStore')
    })

...

controller.spawn({
            token: slackApiToken
        }).startRTM(function(pError, pBot, pPayload) {
            pBot.botkit.saveTeam(pPayload.team);
            channels = pPayload.channels;
            users = pPayload.users;
        });
@stale
Copy link

stale bot commented Oct 22, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 22, 2018
@stale stale bot closed this as completed Oct 30, 2018
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

2 participants