Skip to content

Demo bot crashes when trying to send a message - channel_type = channel['channel']['type'] - KeyError: 'channel' #49

@mechastorm

Description

@mechastorm

Where should I debug this issue I am having? I had spun up the bot from the demo installation instructions.

  • It can join the channel
  • I can manually log it in the channel as well
  • the bot starts up fine

The minute I try to send a message in the public channel

  • example: just saying hello
  • bot detects
  • attempts to send a response
  • crashes

The crash log

[dd/mm/2017 23:16:18] Starting new HTTP connection (1): my-mattermost-server
[dd/mm/2017 23:16:18] http://my-mattermost-server:80 "GET /api/v3/teams/xxx/channels/yyy/ HTTP/1.1" 500 256
Traceback (most recent call last):
  File "/home/vagrant/my-bot/venv/bin/matterbot", line 11, in <module>
    sys.exit(main())
  File "/home/vagrant/my-bot/venv/local/lib/python2.7/site-packages/mattermost_bot/cli.py", line 18, in main
    b.run()
  File "/home/vagrant/my-bot/venv/local/lib/python2.7/site-packages/mattermost_bot/bot.py", line 37, in run
    self._dispatcher.loop()
  File "/home/vagrant/my-bot/venv/local/lib/python2.7/site-packages/mattermost_bot/dispatcher.py", line 116, in loop
    self._on_new_message(self.event)
  File "/home/vagrant/my-bot/venv/local/lib/python2.7/site-packages/mattermost_bot/dispatcher.py", line 92, in _on_new_message
    if self.is_mentioned(msg) or self.is_personal(msg):
  File "/home/vagrant/my-bot/venv/local/lib/python2.7/site-packages/mattermost_bot/dispatcher.py", line 54, in is_personal
    channel_type = channel['channel']['type']
KeyError: 'channel'

Is this a permission issue? My bot account can talk in the public channel with no issues when I manually log it into the system. But through the mattermost bot, it crashes.

My sample config

DEBUG = True
SSL_VERIFY = False
BOT_URL = 'http://my-mattermost-server/api/v3'
BOT_LOGIN = 'my_bot_username'
BOT_PASSWORD = 'my_bot_pass'
BOT_TEAM = 'my-channel'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions