mautrix / googlechat

A Matrix-Google Chat puppeting bridge
https://matrix.to/#/#googlechat:maunium.net
GNU Affero General Public License v3.0
112 stars 30 forks source link

Some chats fail to backfill properly #77

Open dsonck92 opened 2 years ago

dsonck92 commented 2 years ago

I tried to let the bridge backfill some old chats by leaving an existing room, and restarting the bridge, so it would pick up the initial sync again. Currently this fails with the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 509, in ensure_joined
    await self.join_room(room_id, max_retries=0)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 123, in wrapper
    return await __method(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/mautrix/client/store_updater.py", line 62, in join_room
    room_id = await super().join_room(
  File "/usr/lib/python3.9/site-packages/mautrix/client/api/rooms.py", line 320, in join_room
    content = await self.api.request(
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 376, in request
    return await self._send(method, full_url, req_content, query_params, headers or {})
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 255, in _send
    raise make_request_error(
mautrix.errors.request.MForbidden: You are not invited to this room.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 509, in ensure_joined
    await self.join_room(room_id, max_retries=0)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 123, in wrapper
    return await __method(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/mautrix/client/store_updater.py", line 62, in join_room
    room_id = await super().join_room(
  File "/usr/lib/python3.9/site-packages/mautrix/client/api/rooms.py", line 320, in join_room
    content = await self.api.request(
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 376, in request
    return await self._send(method, full_url, req_content, query_params, headers or {})
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 255, in _send
    raise make_request_error(
mautrix.errors.request.MForbidden: You are not invited to this room.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mautrix_googlechat/portal.py", line 319, in backfill
    total_handled = await self._initial_backfill(source)
  File "/usr/lib/python3.9/site-packages/mautrix_googlechat/portal.py", line 353, in _initial_backfill
    await self.handle_googlechat_message(source, topic.replies[0])
  File "/usr/lib/python3.9/site-packages/mautrix_googlechat/portal.py", line 1209, in handle_googlechat_message
    event_id = await self._send_message(intent, content, timestamp=timestamp)
  File "/usr/lib/python3.9/site-packages/mautrix/bridge/portal.py", line 424, in _send_message
    return await intent.send_message_event(self.mxid, event_type, content, **kwargs)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 134, in wrapper
    await __self.ensure_joined(room_id)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 515, in ensure_joined
    await bot.invite_user(room_id, self.mxid)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 134, in wrapper
    await __self.ensure_joined(room_id)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 513, in ensure_joined
    raise IntentError(f"Failed to join room {room_id} as {self.mxid}") from e
mautrix.errors.base.IntentError: Failed to join room !egLgZGAerfYlIvMZdS:sonck.nl as @googlechatbot:sonck.nl