-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/_matrix/client/(r0|v3|unstable)/refresh
endpoint is not valid on workers #15426
Description
Description
I assumed that the endpoint /_matrix/client/(r0|v3|unstable)/refresh
can be routed to workers.
Why?
- as result of the helper script: Add a primitive helper script for listing worker endpoints. #15243
- and it is loaded by workers:
synapse/synapse/rest/__init__.py
Line 100 in 253e86a
login.register_servlets(hs, client_resource) |
synapse/synapse/rest/client/login.py
Lines 671 to 674 in 253e86a
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None: | |
LoginRestServlet(hs).register(http_server) | |
if hs.config.registration.refreshable_access_token_lifetime is not None: | |
RefreshTokenServlet(hs).register(http_server) |
But it cannot routed to workers.
add_refresh_token_to_user
is part of RegistrationStore
and not RegistrationWorkerStore
.
Steps to reproduce
- make a call to a generic worker with a valid refresh token
curl -X POST http://matrix.localhost/_matrix/client/v3/refresh -d '{"refresh_token": "syr_xxxx"}'
Homeserver
another homeserver
Synapse Version
1.78.0
Installation Method
Other (please mention below)
Database
PostgreSQL
Workers
Multiple workers
Platform
Kubernetes
Configuration
No response
Relevant log output
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/synapse/http/server.py", line 306, in _async_render_wrapper
callback_return = await self._async_render(request)
File "/usr/local/lib/python3.10/dist-packages/synapse/http/server.py", line 516, in _async_render
callback_return = await raw_callback_return
File "/usr/local/lib/python3.10/dist-packages/synapse/rest/client/login.py", line 569, in on_POST
) = await self._auth_handler.refresh_token(
File "/usr/local/lib/python3.10/dist-packages/synapse/handlers/auth.py", line 853, in refresh_token
) = await self.create_refresh_token_for_user_id(
File "/usr/local/lib/python3.10/dist-packages/synapse/handlers/auth.py", line 942, in create_refresh_token_for_user_id
refresh_token_id = await self.store.add_refresh_token_to_user(
AttributeError: 'GenericWorkerSlavedStore' object has no attribute 'add_refresh_token_to_user'
Anything else that would be useful to know?
The documentation for workers is correct. The endpoint is not listed there.
I am not sure if add_refresh_token_to_user
can be simply moved to RegistrationWorkerStore
because there is an id generator
synapse/synapse/storage/databases/main/registration.py
Lines 2238 to 2251 in b406573
next_id = self._refresh_tokens_id_gen.get_next() | |
await self.db_pool.simple_insert( | |
"refresh_tokens", | |
{ | |
"id": next_id, | |
"user_id": user_id, | |
"device_id": device_id, | |
"token": token, | |
"next_token_id": None, | |
"expiry_ts": expiry_ts, | |
"ultimate_session_expiry_ts": ultimate_session_expiry_ts, | |
}, | |
desc="add_refresh_token_to_user", |