mautrix / twitter

A Matrix-Twitter DM puppeting bridge
GNU Affero General Public License v3.0
81 stars 19 forks source link

Permission errors when issuing a 'sync' #6

Open tohojo opened 3 years ago

tohojo commented 3 years ago

I noticed that my twitter bridge was not picking up new messages, so I tried to issue a 'sync' which gets me the following response:

Unhandled error while handling command:

Traceback (most recent call last):
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 321, in ensure_joined
    await self.join_room(room_id, max_retries=0)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 80, in wrapper
    return await __method(*args, **kwargs)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/client/api/rooms.py", line 253, in join_room
    content=content, query_params=query_params)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/api.py", line 233, in request
    return await self._send(method, full_url, content, query_params, headers or {})
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/api.py", line 160, in _send
    errcode=errcode, message=message)
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 "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 321, in ensure_joined
    await self.join_room(room_id, max_retries=0)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 80, in wrapper
    return await __method(*args, **kwargs)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/client/api/rooms.py", line 253, in join_room
    content=content, query_params=query_params)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/api.py", line 233, in request
    return await self._send(method, full_url, content, query_params, headers or {})
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/api.py", line 160, in _send
    errcode=errcode, message=message)
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 "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 405, in handle
    await self._run_handler(handler, evt)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 290, in __call__
    return await self._handler(evt)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix_twitter/commands/conn.py", line 45, in sync
    await evt.sender.sync()
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix_twitter/user.py", line 241, in sync
    await self.handle_conversation_update(conversation, create_portal=i < limit)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix_twitter/user.py", line 288, in handle_conversation_update
    await portal.update_info(evt)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix_twitter/portal.py", line 388, in update_info
    await self._update_participants(conv.participants)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix_twitter/portal.py", line 423, in _update_participants
    await puppet.intent_for(self).ensure_joined(self.mxid)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 327, in ensure_joined
    await self.bot.invite_user(room_id, self.mxid)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 91, in wrapper
    await __self.ensure_joined(room_id)
  File "/opt/venvs/mautrix-twitter/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 325, 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 !xxxxxxxxxx:toke.dk as @twitterbot:toke.dk

I tried upgrading the bridge to the latest git version, which didn't help either. I did get new messages to appear after restarting the bridge, but I still get that error when issuing a 'sync' command in the control channel.

koehn commented 3 years ago

I just set up the bridge using the Docker image (mautrix-twitter 0.1.2+dev.257c4c00) and I'm getting the same thing. When a new message comes in from a user with whom I'm not already in a chat, I'm getting this in the log:

[2021-09-16 18:56:54,583] [ERROR@mau.twitter.api.@brad:koehn.com] Error while handling event of type <class 'mautwitdm.types.message.MessageEntry'>
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 336, 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 83, in wrapper
    return await __method(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/mautrix/client/api/rooms.py", line 263, in join_room
    content = await self.api.request(Method.POST, Path.join[room_id_or_alias],
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 259, in request
    return await self._send(method, full_url, content, query_params, headers or {})
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 180, in _send
    raise make_request_error(http_status=response.status,
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 336, 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 83, in wrapper
    return await __method(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/mautrix/client/api/rooms.py", line 263, in join_room
    content = await self.api.request(Method.POST, Path.join[room_id_or_alias],
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 259, in request
    return await self._send(method, full_url, content, query_params, headers or {})
  File "/usr/lib/python3.9/site-packages/mautrix/api.py", line 180, in _send
    raise make_request_error(http_status=response.status,
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 "/opt/mautrix-twitter/mautwitdm/dispatcher.py", line 33, in dispatch
    await handler(event)
  File "/usr/lib/python3.9/site-packages/mautrix/util/opt_prometheus.py", line 47, in wrapper
    return await fn(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/user.py", line 338, in handle_message
    await portal.create_matrix_room(self, evt.conversation)
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/portal.py", line 590, in create_matrix_room
    return await self._create_matrix_room(source, info)
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/portal.py", line 677, in _create_matrix_room
    await self._update_participants(info.participants)
  File "/usr/lib/python3.9/site-packages/mautrix_twitter/portal.py", line 449, in _update_participants
    await puppet.intent_for(self).ensure_joined(self.mxid)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 342, in ensure_joined
    await bot.invite_user(room_id, self.mxid)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 94, in wrapper
    await __self.ensure_joined(room_id)
  File "/usr/lib/python3.9/site-packages/mautrix/appservice/api/intent.py", line 340, 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 ![redacted]:koehn.com as @twitterbot:koehn.com