No connection with docker image 2.0.0 and MM7.1.3
Describe the bug
When I running the docker image with this parameters:
docker run -it --rm -e MATTERMOST_URL=http://192.168.10.6 -e MATTERMOST_PORT=8065 -e BOT_TOKEN=secret jneeven/mmpy_bot:2.0.0
I have this result:
[03/29/2023 08:43:43] Starting bot Bot.
[03/29/2023 08:43:43] Scheduler thread started.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 827, in transfer_data
message = await self.read_message()
File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 895, in read_message
frame = await self.read_data_frame(max_size=self.max_size)
File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 971, in read_data_frame
frame = await self.read_frame(max_size)
File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 1047, in read_frame
frame = await Frame.read(
File "/usr/local/lib/python3.8/site-packages/websockets/framing.py", line 105, in read
data = await reader(2)
File "/usr/local/lib/python3.8/asyncio/streams.py", line 721, in readexactly
raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "entrypoint.py", line 9, in <module>
bot.run()
File "/app/mmpy_bot/bot.py", line 88, in run
self.event_handler.start()
File "/app/mmpy_bot/event_handler.py", line 44, in start
self.driver.init_websocket(self._handle_event)
File "/usr/local/lib/python3.8/site-packages/mattermostdriver/driver.py", line 148, in init_websocket
loop.run_until_complete(self.websocket.connect(event_handler))
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/usr/local/lib/python3.8/site-packages/mattermostdriver/websocket.py", line 49, in connect
await self._authenticate_websocket(websocket, event_handler)
File "/usr/local/lib/python3.8/site-packages/mattermostdriver/websocket.py", line 86, in _authenticate_websocket
message = await websocket.recv()
File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 509, in recv
await self.ensure_open()
File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 803, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
How To Reproduce Just run this previous code
Expected behavior Connection ok
Operating Environment (please complete the following information):
- mmpy_bot Version: version in docker image 2.0.0
- mattermostdriver/mattermostautodriver Version: where to find ?
- Mattermost Server Version: 7.1.3
- Python Version: docker image 2.0.0
- OS: linux
Additional context
I run a curl comment from my container:
curl -i -X POST -H 'Content-Type: application/json' -d '{"channel_id":"mxa5hxw8b7y17bmaiisi9wzpiy", "message":"This is a message from a bot", "props":{"attachments": [{"pretext": "Look some text","text": "This is text"}]}}' -H 'Authorization: Bearer secret' http://192.168.10.6:8065/api/v4/posts
And that work
The docker image is a little old by now. Can you try with the latest release?
Yes that, but it is a pity that docker image not work. For future :
git clone https://github.com/attzonko/mmpy_bot.git
cd mmpy_bot
docker build . -t mmpy_bot
docker run -it --rm --name mattermost-bot \
-e MATTERMOST_URL=http://<ip>/ \
-e MATTERMOST_PORT=<port> \
-e BOT_TOKEN=<secret> \
mmpy_bot:lastest
et voilà