Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Bridge creates room it can't see #137

Open
tcpipuk opened this issue Sep 2, 2023 · 1 comment
Open

Bridge creates room it can't see #137

tcpipuk opened this issue Sep 2, 2023 · 1 comment

Comments

@tcpipuk
Copy link

tcpipuk commented Sep 2, 2023

This is a peculiar one and I'm not sure if it's my config, but there's almost always one conversation in Instagram that just won't sync properly and I've been struggling to get to the bottom of it.

I can see the bridge is creating the room and setting the right invites, etc:

[2023-09-02 11:12:19,159] [DEBUG@mau.portal.340282366841710300949128151762713931822] Matrix room created: !VYCGPuPaXrSkEwnmHR:tcpip.uk
[2023-09-02 11:12:19,167] [DEBUG@mau.as.api.@instagram_506211844:tcpip.uk] req #180: PUT http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk?user_id=@instagram_506211844:tcpip.uk {"membership": "invite", "avatar_url": "mxc://tcpip.uk/RaMqxgxIZUuDUaHZSKYvWkoK", "displayname": "Tom Black", "is_direct": true, "fi.mau.will_auto_accept": true}
[2023-09-02 11:12:19,265] [DEBUG@mau.as.api.@instagram_506211844:tcpip.uk] req #180 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk) completed in 98.0ms with status 200
[2023-09-02 11:12:19,274] [DEBUG@mau.as.api.@tom:tcpip.uk] req #181: PUT http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk {"membership": "join", "avatar_url": "mxc://tcpip.uk/RaMqxgxIZUuDUaHZSKYvWkoK", "displayname": "Tom Black", "is_direct": false, "fi.mau.double_puppet_source": "mautrix-instagram"}
[2023-09-02 11:12:19,363] [DEBUG@mau.as.api.@tom:tcpip.uk] req #181 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/state/m.room.member/%40tom%3Atcpip.uk) completed in 88.3ms with status 200
[2023-09-02 11:12:19,369] [DEBUG@mau.as.api.@instagram_506211844:tcpip.uk] req #183: GET http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/joined_members?user_id=@instagram_506211844:tcpip.uk None
[2023-09-02 11:12:19,377] [DEBUG@mau.as.api.@instagram_506211844:tcpip.uk] req #183 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/joined_members) completed in 7.5ms with status 200
[2023-09-02 11:12:19,385] [DEBUG@mau.as.api.@instagram_506211844:tcpip.uk] req #184: PUT http://nginx:8008/_matrix/client/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/send/fi.mau.dummy.portal_created/mautrix-python_1693653139385739144_2?user_id=@instagram_506211844:tcpip.uk {}
[2023-09-02 11:12:19,440] [DEBUG@mau.as.api.@instagram_506211844:tcpip.uk] req #184 (/v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/send/fi.mau.dummy.portal_created/mautrix-python_1693653139385739144_2) completed in 54.5ms with status 200

Then when it tries to actually add messages to the portal, it gets 403s and fails, repeatedly trying the same thing:

[2023-09-02 11:12:20,077] [DEBUG@mau.as.api.@instagram_506211844:tcpip.uk] req #187 (/_matrix/media/v3/upload) completed in 45.8ms with status 200
[2023-09-02 11:12:20,077] [INFO@mau.portal.340282366841710300949128151762713931822] Sending 14 new messages to !VYCGPuPaXrSkEwnmHR:tcpip.uk with batch ID None and previous event ID $Ono9I92-TVGu2k1NCpTCwf7uYSfROtF5E90eQYkckZg
[2023-09-02 11:12:20,078] [DEBUG@mau.as.api.@instagram_30592806:tcpip.uk] req #188: POST http://nginx:8008/_matrix/client/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk?user_id=@instagram_30592806:tcpip.uk {}
[2023-09-02 11:12:20,123] [DEBUG@mau.as.api.@instagram_30592806:tcpip.uk] req #188 (/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk) completed in 44.5ms with status 403
[2023-09-02 11:12:20,125] [DEBUG@mau.as.api.bot] req #189: POST http://nginx:8008/_matrix/client/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk?user_id=@instagrambot:tcpip.uk {}
[2023-09-02 11:12:20,142] [DEBUG@mau.as.api.bot] req #189 (/v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk) completed in 17.7ms with status 403
[2023-09-02 11:12:20,143] [ERROR@mau.user.@tom:tcpip.uk] Failed to sync threads. Waiting 30 seconds before retrying sync.
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 592, in ensure_joined
    await self.join_room(room_id, max_retries=0)
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
    return await __method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
    room_id = await super().join_room(
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
    content = await self.api.request(
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 395, in request
    resp_data, resp = await self._send(
                      ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 250, 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.11/site-packages/mautrix/appservice/api/intent.py", line 592, in ensure_joined
    await self.join_room(room_id, max_retries=0)
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
    return await __method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
    room_id = await super().join_room(
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
    content = await self.api.request(
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 395, in request
    resp_data, resp = await self._send(
                      ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 250, 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.11/site-packages/mautrix_instagram/user.py", line 840, in run_with_sync_lock
    await func()
  File "/usr/lib/python3.11/site-packages/mautrix_instagram/user.py", line 777, in _backfill_threads
    await self._sync_threads_with_delay(
  File "/usr/lib/python3.11/site-packages/mautrix_instagram/user.py", line 813, in _sync_threads_with_delay
    had_new_messages = await self._sync_thread(thread)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix_instagram/user.py", line 640, in _sync_thread
    base_insertion_event_id = await portal.backfill_message_page(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mautrix_instagram/portal.py", line 2424, in backfill_message_page
    event_ids = [
                ^
  File "/usr/lib/python3.11/site-packages/mautrix_instagram/portal.py", line 2425, in <listcomp>
    await intent.send_message_event(
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
    await __self.ensure_joined(room_id)
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 598, in ensure_joined
    await bot.invite_user(room_id, self.mxid)
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
    await __self.ensure_joined(room_id)
  File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, 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 !VYCGPuPaXrSkEwnmHR:tcpip.uk as @instagrambot:tcpip.uk

It seems to be repeatedly trying to join when I can see the bot user already in the room - having spoken to other people using the bridge, they don't seem to have the same issue, so I'm not sure what I might be doing wrong?

@tcpipuk
Copy link
Author

tcpipuk commented Sep 2, 2023

On second thoughts... is the problem that it's using /v3/join/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk instead of /v3/rooms/%21VYCGPuPaXrSkEwnmHR%3Atcpip.uk/join?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant