nautobot-app-chatops
nautobot-app-chatops copied to clipboard
Mattermost Commands not working
Environment
- Python version: 3.9.2
- Nautobot version: 2.0.5
- nautobot-chatops version: 3.0.1
- Mattermost version: 7.8.0
Expected Behavior
Working commands in Mattermost
Observed Behavior
Every time I send a command in Mattermost towards Nautobot I get the message "Command with a trigger of 'nautobot' returned response 500 Internal Server Error". The following messages can be found in the Nautobot log at DEBUG level:
Dez 05 14:57:30 netdoc nautobot-server[70872]: 14:57:30.621 ERROR django.request :
Dez 05 14:57:30 netdoc nautobot-server[70872]: Internal Server Error: /api/plugins/chatops/mattermost/slash_command/
Dez 05 14:57:30 netdoc nautobot-server[70872]: Traceback (most recent call last):
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/nautobot_chatops/dispatchers/mattermost.py", line 78, in inner
Dez 05 14:57:30 netdoc nautobot-server[70872]: return function(*args, **kwargs)
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/nautobot_chatops/dispatchers/mattermost.py", line 143, in post
Dez 05 14:57:30 netdoc nautobot-server[70872]: mm_response.raise_for_status()
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/requests/models.py", line 960, in raise_for_status
Dez 05 14:57:30 netdoc nautobot-server[70872]: raise HTTPError(http_error_msg, response=self)
Dez 05 14:57:30 netdoc nautobot-server[70872]: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://mattermost.<redacted>/api/v4/users/me/typing
Dez 05 14:57:30 netdoc nautobot-server[70872]: During handling of the above exception, another exception occurred:
Dez 05 14:57:30 netdoc nautobot-server[70872]: Traceback (most recent call last):
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
Dez 05 14:57:30 netdoc nautobot-server[70872]: response = get_response(request)
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
Dez 05 14:57:30 netdoc nautobot-server[70872]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
Dez 05 14:57:30 netdoc nautobot-server[70872]: return self.dispatch(request, *args, **kwargs)
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper
Dez 05 14:57:30 netdoc nautobot-server[70872]: return bound_method(*args, **kwargs)
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Dez 05 14:57:30 netdoc nautobot-server[70872]: return view_func(*args, **kwargs)
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
Dez 05 14:57:30 netdoc nautobot-server[70872]: return handler(request, *args, **kwargs)
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/nautobot_chatops/api/views/mattermost.py", line 114, in post
Dez 05 14:57:30 netdoc nautobot-server[70872]: MattermostDispatcher(context).send_busy_indicator()
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/nautobot_chatops/dispatchers/mattermost.py", line 458, in send_busy_indicator
Dez 05 14:57:30 netdoc nautobot-server[70872]: self.mm_client.post("/users/me/typing", data={"channel_id": self.context.get("channel_id")})
Dez 05 14:57:30 netdoc nautobot-server[70872]: File "/srv/nautobot/venv/lib/python3.9/site-packages/nautobot_chatops/dispatchers/mattermost.py", line 89, in inner
Dez 05 14:57:30 netdoc nautobot-server[70872]: raise NotFoundException(f"Attempting to access an endpoint that does not exist: {err.response.text}")
Dez 05 14:57:30 netdoc nautobot-server[70872]: nautobot_chatops.dispatchers.mattermost.NotFoundException: Attempting to access an endpoint that does not exist: {"id":"api.context.404.app_error","message":"Sorry, we could not find the page.","detailed_error":"There doesn't appear to be an api call for the url='/api/v4/users/me/typing'. Typo? are you missing a team_id or user_id as part of the url?","status_code":404}
Dez 05 14:57:30 netdoc nautobot-server[70872]: [pid: 70872|app: 0|req: 7/7] 127.0.0.1 () {48 vars in 779 bytes} [Tue Dec 5 14:57:30 2023] POST /api/plugins/chatops/mattermost/slash_command/ => generated 36891 bytes in 41 msecs (HTTP/1.0 500) 6 headers in 210 bytes (1 switches on core 0)
Steps to Reproduce
- Setup Plugin
- Send Command over Mattermost