matrix-docker-ansible-deploy
matrix-docker-ansible-deploy copied to clipboard
Matrix Dimension makes Matrix API call that 404s
Describe the bug Matrix Dimension makes API call to upload media to Matrix at the address matrix-synapse:8008 and receives a 404
To Reproduce
My vars.yml
file looks like this:
matrix_domain: XXXX
matrix_homeserver_implementation: synapse
matrix_homeserver_generic_secret_key: 'XXXX'
matrix_postgres_connection_password: 'XXXX'
matrix_synapse_workers_enabled: true
matrix_synapse_workers_preset: one-of-each
matrix_postgres_process_extra_arguments: [
"-c 'max_connections=200'"
]
matrix_client_element_themes_enabled: true
matrix_nginx_proxy_enabled: false
matrix_mailer_sender_address: "XXXX"
matrix_mailer_relay_use: true
matrix_mailer_relay_host_name: "XXXX"
matrix_mailer_relay_host_port: 587
matrix_mailer_relay_auth: true
matrix_mailer_relay_auth_username: "XXXX"
matrix_mailer_relay_auth_password: "XXXX"
matrix_synapse_allow_public_rooms_over_federation: true
matrix_synapse_admin_enabled: true
matrix_synapse_enable_registration_captcha: true
matrix_synapse_recaptcha_public_key: 'XXXX'
matrix_synapse_recaptcha_private_key: 'XXXX'
matrix_synapse_enable_registration: true
matrix_dimension_enabled: true
matrix_dimension_admins:
- "@XXX:XXX.XX"
matrix_dimension_access_token: "XXX"
matrix_dimension_configuration_extension_yaml: |
telegram:
botToken: "XXX"
In the integration manager for dimension, go to settings, the to import sticker packs. Input a sticker pack into the box and click submit. It will load for a second then give an error.
Found this bellow in the log:
Tue, 06 Sep 2022 03:49:38 GMT [INFO] [AdminStickerService] Importing https://t.me/addstickers/digimoji1 from Telegram for @XXX:XXX.XX
Tue, 06 Sep 2022 03:49:40 GMT [DEBUG] [DimensionStore [SQL]] Executing (default): INSERT INTO "dimension_sticker_packs" ("id","type","name","avatarUrl","description","isEnabled","isPublic","authorType","authorReference","authorName","license","licensePath") VALUES (DEFAULT,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11) RETURNING "id","type","name","avatarUrl","description","isEnabled","isPublic","authorType","authorReference","authorName","license","licensePath","trackingRoomAlias";
Tue, 06 Sep 2022 03:49:40 GMT [INFO] [AdminStickerService] Importing sticker from https://api.telegram.org/file/XXXXX/stickers/file_71.webp
Tue, 06 Sep 2022 03:49:40 GMT [INFO] [matrix] Doing client API call: http://matrix-synapse:8008/_matrix/media/r0/upload
Tue, 06 Sep 2022 03:49:40 GMT [ERROR] [matrix] Got status code 404 while calling client endpoint /_matrix/media/r0/upload
Expected behavior Dimension server connect to matrix-synapse and stickers are uploaded.
Matrix Server:
- OS: Ubuntu 22.04
- Architecture: amd64
- nginx with the correct files included in the nginx.conf
Additional context I believe this is the same issue as #1449
I also attemtped to change the Client/Server address in the config to no avail
This is because we point Dimension to matrix_homeserver_container_url
, which.. if matrix-nginx-proxy
is enabled, points to http://matrix-nginx-proxy:12080
-- a vhost, which can properly forward traffic to the appropriate Synapse worker:
https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/05819056bc16b7e5ba2e75060bf1e9dcb003f999/group_vars/matrix_servers#L20-L29
If matrix-nginx-proxy
is disabled (like it is in your configuration), we can't point matrix_homeserver_container_url
to http://matrix-nginx-proxy:12080
(because there is no such container), so we point it directly to Synapse's master
process (http://matrix-synapse:8008
). In that case: if Synapse workers are not enabled, we're still - the Synapse master
process will handle all URL endpoints. If workers are enabled however, Synapse's master
process will refuse to serve media_repository
worker endpoints (like /_matrix/media/r0/upload
), because it's the media_repository
worker that is supposed to be serving those endpoints.
So.. your problem is that.. you're both enabling Synapse workers.. and disabling matrix-nginx-proxy
.. A combination that is destined to bring you pain.
Consider keeping matrix-nginx-proxy
enabled.. or disabling Synapse workers.
If you need another reverse proxy in front, you may be able to follow these docs: Fronting the integrated nginx reverse-proxy webserver with another reverse-proxy.
In 05819056 I've adjusted the documentation to make this more obvious.