hifi / heisenbridge

a bouncer-style Matrix IRC bridge
MIT License
241 stars 32 forks source link

mautrix.errors.request.MUnknownToken: Unrecognised access token #264

Closed ronilaukkarinen closed 6 months ago

ronilaukkarinen commented 1 year ago

I'm sure I followed the instructions pretty thoroughly, but still getting this:

# /usr/local/bin/heisenbridge -c /etc/matrix-synapse/conf.d/heisenbridge.yaml -p 9897
Heisenbridge v1.14.5
ERROR:root:Unexpected failure when registering appservice user.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/heisenbridge-1.14.5-py3.10.egg/heisenbridge/__main__.py", line 502, in run
    await self.api.request(
  File "/usr/local/lib/python3.10/dist-packages/mautrix/api.py", line 395, in request
    resp_data, resp = await self._send(
  File "/usr/local/lib/python3.10/dist-packages/mautrix/api.py", line 250, in _send
    raise make_request_error(
mautrix.errors.request.MUnknownToken: Unrecognised access token
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fc3a138d9c0>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fc3a13b2560>, 819481.518503257)]']
connector: <aiohttp.connector.TCPConnector object at 0x7fc3a138da80>

The generated yaml file should be ok.

lnicola commented 10 months ago

Perhaps moving the yaml to a different place. If you're using split Synapse config files, there are two files involved, one generated by heisenbridge, and one Synapse needs to load the former. Mine was:

app_service_config_files:
  - /etc/matrix-synapse/appservices.d/heisenbridge.yaml

So Synapse loads everything in /etc/matrix-synapse/conf.d/ as Synapse config, but the Heisenbridge config file isn't that.

KhalilSantana commented 8 months ago

I've tried using @lnicola's approach without success (Synapse server running on NixOS + heisenbridge inside a docker container with --network host)

ronilaukkarinen commented 6 months ago

Also tried @lnicola's approach. Same error.

ronilaukkarinen commented 6 months ago

Okay, so re-read the README.md. It assumes too much, somehow skipped the part 4, "Add heisenbridge.yaml to Synapse appservice list". I had no idea how this happens, so here is how, based on this (also bad documentation imho).

sudo nano /etc/matrix-synapse/homeserver.yaml

Search for app_service_config_files, if no such settings, add to bottom:

app_service_config_files:
  - /etc/matrix-synapse/conf.d/heisenbridge.yaml

Restart Synapse:

systemctl restart matrix-synapse

Then the command should work. Or use a systemd service or whatever. Works now for me so I can close this issue.