-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Join room from invitation client-server API fails for Synapse 1.71.0 #14478
Comments
First POST request
The warnings comes from synapse/synapse/http/servlet.py Lines 665 to 677 in 1bf2832
This is caught here and dealt with, but the warning is not suppressed: synapse/synapse/rest/client/room.py Lines 955 to 960 in 86c5a71
To get rid of the warning, you should send an empty JSON object
Your logs aren't sufficient to demonstrate this.
Can you please grep for all lines in your Synapse logs matching Second POST request
This comes from Lines 419 to 460 in eaed4e6
The warning is Synapse's way of saying it doesn't recognise your token.
Your logs aren't consistent with this.
This suggests we returned HTTP 401 Unauthorized; I'd expect 200 Ok for a successful join. Can you please also provide all logs containing |
As an aside -- it is recommended that you send an access token via headers, not a query parameter. Your above code could be corrected for this (and the empty body) with: def accept_invitation(self, room_id=None, access_token=None):
try:
assert room_id
if not access_token:
access_token = self.conf['auth_token']
response = requests.post(
f'''{self.conf['server_url']}/_matrix/client/v3/rooms/{room_id}/join''',
headers = {
"Authorization": f"Bearer {access_token}",
},
json={},
)
return True
except Exception as e:
log.error(f'''ERROR accepting invitation: {e}''')
return False |
Thank you both for your responses. While I still do not understand why the original Python code did not work as it did before, it is possible that a problem with my Redis server that I discovered after creating this issue was actually to blame for the odd behavior. The improved code shared by @clokep worked perfectly to join the account to a new room I created to test it. We can close this. |
We've already decided to allow empty bodies for backwards compat. The change here stops us from emitting a misleading warning; see also #14478 (comment)
* Suppress empty body warnings in room servelets We've already decided to allow empty bodies for backwards compat. The change here stops us from emitting a misleading warning; see also #14478 (comment) * Changelog
* Suppress empty body warnings in room servelets We've already decided to allow empty bodies for backwards compat. The change here stops us from emitting a misleading warning; see also #14478 (comment) * Changelog
Description
I am unable to join a room using an access token on v1.71.0 using the same code that worked on v1.69.0. The Python function I am using is
When I provide the access token for the invited Matrix account and the room to be joined, I get a warning in the Synapse server logs as shown below, where no response is ever sent and the account is not allowed to join the room:
However, a subsequent identical API call, but using a blank or invalid access token, actually allows the account to join the room!
Steps to reproduce
_matrix/client/v3/rooms/{room_id}/join
API function. The request will stall and the account will not join the room.Homeserver
matrix.musesframework.io
Synapse Version
1.71.0
Installation Method
Docker (matrixdotorg/synapse)
Platform
Kubernetes, using this Helm chart
Relevant log output
Anything else that would be useful to know?
No response
The text was updated successfully, but these errors were encountered: