[GH-ISSUE #1257] Matrix integration broken in 4.0 #849

Closed
opened 2026-02-25 23:43:48 +03:00 by kerem · 3 comments
Owner

Originally created by @estevez-dev on GitHub (Jan 23, 2026).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/1257

After updating to version 4.0, Matrix integration stopped working.

Here are logs from the Matrix server:

2026-01-23 10:17:18,451 - synapse.access.http.8008 - 521 - INFO - PUT-186671 - 192.168.50.1 - 8008 - {@******:example.com} Processed request: 0.001sec/0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 55B 500 "PUT /_matrix/client/v3/rooms/%21PJHpsrruyQOFyShxzw%3Aexample.com/send/m.room.message/9a8a5bf9-4677-4ead-a771-78f60eeba9ee HTTP/1.1" "healthchecks.io" [0 dbevts]
2026-01-23 10:17:18,474 - synapse.http.server - 147 - ERROR - PUT-186672 - Failed handle request via 'RoomSendEventRestServlet': <XForwardedForRequest at 0x7ede13ce68d0 method='PUT' uri='/_matrix/client/v3/rooms/%21PJHpsrruyQOFyShxzw%3Aexample.com/send/m.room.message/9a8a5bf9-4677-4ead-a771-78f60eeba9ee' clientproto='HTTP/1.1' site='8008'>
Traceback (most recent call last):
  File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/http/server.py", line 335, in _async_render_wrapper
    callback_return = await self._async_render(request)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/http/server.py", line 576, in _async_render
    callback_return = await raw_callback_return
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/rest/client/room.py", line 478, in on_PUT
    return await self.txns.fetch_or_execute_request(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/rest/client/transactions.py", line 123, in fetch_or_execute_request
    txn_key = self._get_transaction_key(request, requester)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/rest/client/transactions.py", line 98, in _get_transaction_key
    assert requester.access_token_id is not None, (
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Requester must have an access_token_id

In version 3.13, this setup worked fine.

Docker.
MATRIX_HOMESERVER and MATRIX_USER_ID set. MATRIX_ACCESS_TOKEN is populated with a personal token generated in Element Admin.

Login API call from docs doesn't applicable as I'm using Matrix Authentication Server.

Originally created by @estevez-dev on GitHub (Jan 23, 2026). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/1257 After updating to version 4.0, Matrix integration stopped working. Here are logs from the Matrix server: ``` 2026-01-23 10:17:18,451 - synapse.access.http.8008 - 521 - INFO - PUT-186671 - 192.168.50.1 - 8008 - {@******:example.com} Processed request: 0.001sec/0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 55B 500 "PUT /_matrix/client/v3/rooms/%21PJHpsrruyQOFyShxzw%3Aexample.com/send/m.room.message/9a8a5bf9-4677-4ead-a771-78f60eeba9ee HTTP/1.1" "healthchecks.io" [0 dbevts] 2026-01-23 10:17:18,474 - synapse.http.server - 147 - ERROR - PUT-186672 - Failed handle request via 'RoomSendEventRestServlet': <XForwardedForRequest at 0x7ede13ce68d0 method='PUT' uri='/_matrix/client/v3/rooms/%21PJHpsrruyQOFyShxzw%3Aexample.com/send/m.room.message/9a8a5bf9-4677-4ead-a771-78f60eeba9ee' clientproto='HTTP/1.1' site='8008'> Traceback (most recent call last): File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/http/server.py", line 335, in _async_render_wrapper callback_return = await self._async_render(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/http/server.py", line 576, in _async_render callback_return = await raw_callback_return ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/rest/client/room.py", line 478, in on_PUT return await self.txns.fetch_or_execute_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/rest/client/transactions.py", line 123, in fetch_or_execute_request txn_key = self._get_transaction_key(request, requester) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venvs/matrix-synapse/lib/python3.12/site-packages/synapse/rest/client/transactions.py", line 98, in _get_transaction_key assert requester.access_token_id is not None, ( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: Requester must have an access_token_id ``` In version 3.13, this setup worked fine. Docker. `MATRIX_HOMESERVER` and `MATRIX_USER_ID` set. `MATRIX_ACCESS_TOKEN` is populated with a personal token generated in Element Admin. Login API call from [docs](https://healthchecks.io/docs/self_hosted_configuration/#MATRIX_ACCESS_TOKEN) doesn't applicable as I'm using Matrix Authentication Server.
kerem closed this issue 2026-02-25 23:43:48 +03:00
Author
Owner

@cuu508 commented on GitHub (Jan 23, 2026):

In 4.0 there is a code change to use a newer Matrix client-server API endpoint.

Issue: https://github.com/healthchecks/healthchecks/issues/1244
Commit: dbd9677b8a

The changes in nutshell were:

  • Change API endpoint from /_matrix/client/r0/rooms/{room_id}/send/m.room.message to /_matrix/client/v3/rooms/{room_id}/send/m.room.message/{random_token}
  • Change HTTP request method from POST to PUT
  • Pass the access token in the "Authorization" request header, not in the URL query string

I tested the changes against matrix.org.

Are you perhaps running an old version of Synapse?

If Healthchecks is using Matrix client-server API incorrectly, I'm happy to work on fixing it, but I will need some help in figuring out what precisely is being done incorrectly.

<!-- gh-comment-id:3789245580 --> @cuu508 commented on GitHub (Jan 23, 2026): In 4.0 there is a code change to use a newer Matrix client-server API endpoint. Issue: https://github.com/healthchecks/healthchecks/issues/1244 Commit: dbd9677b8a10c979afdb7784b39aa60345baf964 The changes in nutshell were: * Change API endpoint from `/_matrix/client/r0/rooms/{room_id}/send/m.room.message` to `/_matrix/client/v3/rooms/{room_id}/send/m.room.message/{random_token}` * Change HTTP request method from POST to PUT * Pass the access token in the "Authorization" request header, not in the URL query string I tested the changes against matrix.org. Are you perhaps running an old version of Synapse? If Healthchecks is using Matrix client-server API incorrectly, I'm happy to work on fixing it, but I will need some help in figuring out what precisely is being done incorrectly.
Author
Owner

@estevez-dev commented on GitHub (Jan 23, 2026):

In 4.0 there is a code change to use a newer Matrix client-server API endpoint.

Issue: #1244 Commit: dbd9677

The changes in nutshell were:

  • Change API endpoint from /_matrix/client/r0/rooms/{room_id}/send/m.room.message to /_matrix/client/v3/rooms/{room_id}/send/m.room.message/{random_token}
  • Change HTTP request method from POST to PUT
  • Pass the access token in the "Authorization" request header, not in the URL query string

I tested the changes against matrix.org.

Are you perhaps running an old version of Synapse?

If Healthchecks is using Matrix client-server API incorrectly, I'm happy to work on fixing it, but I will need some help in figuring out what precisely is being done incorrectly.

I'm using Synapse 1.144.0. Not the latest, but a fresh one. I'm not very familiar with the Matrix API. Maybe the MATRIX_ACCESS_TOKEN needed for this integration is not the same as the one I'm generating in Element Admin. I'll try to upgrade Synapse to the latest version and investigate the tokens.

<!-- gh-comment-id:3789465789 --> @estevez-dev commented on GitHub (Jan 23, 2026): > In 4.0 there is a code change to use a newer Matrix client-server API endpoint. > > Issue: [#1244](https://github.com/healthchecks/healthchecks/issues/1244) Commit: [dbd9677](https://github.com/healthchecks/healthchecks/commit/dbd9677b8a10c979afdb7784b39aa60345baf964) > > The changes in nutshell were: > > * Change API endpoint from `/_matrix/client/r0/rooms/{room_id}/send/m.room.message` to `/_matrix/client/v3/rooms/{room_id}/send/m.room.message/{random_token}` > * Change HTTP request method from POST to PUT > * Pass the access token in the "Authorization" request header, not in the URL query string > > I tested the changes against matrix.org. > > Are you perhaps running an old version of Synapse? > > If Healthchecks is using Matrix client-server API incorrectly, I'm happy to work on fixing it, but I will need some help in figuring out what precisely is being done incorrectly. I'm using Synapse 1.144.0. Not the latest, but a fresh one. I'm not very familiar with the Matrix API. Maybe the `MATRIX_ACCESS_TOKEN` needed for this integration is not the same as the one I'm generating in Element Admin. I'll try to upgrade Synapse to the latest version and investigate the tokens.
Author
Owner

@estevez-dev commented on GitHub (Jan 23, 2026):

I managed to fix that. For the new API to work, a Matrix device should be provisioned for the access token.

In Element Admin, it is done by enabling urn:matrix:client:device: scope when creating an access token.

<!-- gh-comment-id:3790560304 --> @estevez-dev commented on GitHub (Jan 23, 2026): I managed to fix that. For the new API to work, a Matrix device should be provisioned for the access token. In Element Admin, it is done by enabling `urn:matrix:client:device:` scope when creating an access token.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#849
No description provided.