hifi / heisenbridge

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

Docker `1.5` and `latest` fail to pastebin to IRC #297

Closed geekosaur closed 1 week ago

geekosaur commented 1 week ago

Using hif1/heisenbridge:latest:

heisenbridge-1  | ERROR:root:Ignoring exception from room handler. This should be fixed.
heisenbridge-1  | Traceback (most recent call last):
heisenbridge-1  |   File "/opt/heisenbridge/heisenbridge/__main__.py", line 233, in _on_mx_event
heisenbridge-1  |     await room.on_mx_event(event)
heisenbridge-1  |   File "/opt/heisenbridge/heisenbridge/room.py", line 100, in on_mx_event
heisenbridge-1  |     await handler(event)
heisenbridge-1  |   File "/opt/heisenbridge/heisenbridge/plumbed_room.py", line 257, in on_mx_message
heisenbridge-1  |     await self.relay_message(event, self.network.conn.privmsg, sender)
heisenbridge-1  |   File "/opt/heisenbridge/heisenbridge/plumbed_room.py", line 271, in relay_message
heisenbridge-1  |     await self._send_message(event, func, prefix)
heisenbridge-1  |   File "/opt/heisenbridge/heisenbridge/private_room.py", line 819, in _send_message
heisenbridge-1  |     f"... long message truncated: {self.serv.mxc_to_url(str(content_uri))} ({len(messages)} lines)",
heisenbridge-1  |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
heisenbridge-1  |   File "/opt/heisenbridge/heisenbridge/__main__.py", line 385, in mxc_to_url
heisenbridge-1  |     if not self.media_endpoint:
heisenbridge-1  |            ^^^^^^^^^^^^^^^^^^^
heisenbridge-1  | AttributeError: 'BridgeAppService' object has no attribute 'media_endpoint'

IRC only receives the first line, since the second line with the pastebin URL is obviously never sent. On Matrix side, if REACTS are enabled then the pastebin react is not shown.

If it matters (I was able to reproduce with multiple inputs), the message I sent to trigger the above message was:

```
test message so I can file a bug report
line 2
line 3
```

Everything works as expected with the 1.14 image.

If it matters, the redacted Docker compose file is:

# This compose file is compatible with Compose itself, it might need some
# adjustments to run properly with stack.

services:

  heisenbridge:
    # image: hif1/heisenbridge:latest
    image: hif1/heisenbridge:1.14
    volumes:
      - ./init/heisenbridge-init.sh:/heisenbridge-init.sh:ro
      - ./files:/data
    entrypoint: /heisenbridge-init.sh
    user: nobody
    depends_on:
      - synapse

  maubot:
    image: dock.mau.dev/maubot/maubot:latest
    restart: unless-stopped
    volumes:
      - ./maubot:/data
    ports:
      - 29316:29316
    expose:
      - 29316:29316
    depends_on:
      - synapse

  synapse:
    image: docker.io/matrixdotorg/synapse:latest
    # Since synapse does not retry to connect to the database, restart upon
    # failure
    restart: unless-stopped
    # See the readme for a full documentation of the environment settings
    # NOTE: You must edit homeserver.yaml to use postgres, it defaults to sqlite
    environment:
      - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
    volumes:
      # You may either store all the files in a local folder
      - ./files:/data
      # .. or you may split this between different storage points
      # - ./files:/data
      # - /path/to/ssd:/data/uploads
      # - /path/to/large_hdd:/data/media
    depends_on:
      - db
      - redis

  db:
    image: docker.io/postgres:12-alpine
    # Change that password, of course!
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=[REDACTED]
      # ensure the database gets created correctly
      # https://element-hq.github.io/synapse/latest/postgres.html#set-up-database
      - POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
    expose:
      - 5432:5432
    volumes:
      # You may store the database tables in a local folder..
      - ./schemas:/var/lib/postgresql/data
      # .. or store them on some high performance storage for better results
      # - /path/to/ssd/storage:/var/lib/postgresql/data

  nginx:
    image: docker.io/nginx:latest
    volumes:
      - ./web:/usr/share/nginx/html:ro
      - ./nginx-conf:/etc/nginx/conf.d
      - ./certbot:/var/www/certbot:ro
      - ./letsencrypt:/etc/letsencrypt:ro
    restart: always
    # needed to read TLS certs; will downgrade itself afterward
    user: root
    ports:
      - 8448:8448
      - 443:443
      - 80:80
    depends_on:
      - synapse
      - maubot

  redis:
    image: docker.io/redis:latest
    volumes:
      - ./redis-conf:/usr/local/etc/redis
      - ./redis-data:/redis-data
    expose:
      - 6379:6379

  certbot:
    image: certbot/certbot:latest
    volumes:
      - ./certbot:/var/www/certbot
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - nginx
    profiles:
      - dummy
tulir commented 1 week ago

Did you forget to configure media like the release notes say?

geekosaur commented 1 week ago

Where are these release notes hidden? They do not appear to be on GitHub or Docker Hub.

tulir commented 1 week ago

They're on GitHub in the releases section: https://github.com/hifi/heisenbridge/releases/tag/v1.15.0

geekosaur commented 1 week ago

May I suggest that these be made more visible in the future? Preferably I would expect to see a changelog at the top level of the repo and release notes in a subdirectory for reference. People who use the Docker latest image won't know about them currently, nor I suspect will people using pip install --upgrade as the README suggests.

tulir commented 1 week ago

There probably won't be any more releases before someone gets around to rewriting the bridge in Go