This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Calls to /_matrix/client/v3/account/whoami return 500 when called on a unix socket #16396
Copy link
Copy link
Closed
Labels
O-UncommonMost users are unlikely to come across this or unexpected workflowMost users are unlikely to come across this or unexpected workflowS-MinorBlocks non-critical functionality, workarounds exist.Blocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.Z-Help-WantedWe know exactly how to fix this issue, and would be grateful for any contributionWe know exactly how to fix this issue, and would be grateful for any contributiongood first issueGood for newcomersGood for newcomers
Description
Description
I have synapse set up to listen on a unix socket, and mautrix-whatsapp trying to connect to it via that socket. This does not work, as when accessing the whoami-endpoint the server returns error code 500 with the message M_UNKNOWN.
The homeserver log reveals that this is due to the code expecting a host to be set, when this isn't applicable in a unix socket usecase.
Steps to reproduce
- Configure synapse to listen on unix socket
- Configure appservice (mautrix-whatsapp) that accesses the
whoamiendpoint to connect to server via unix socket
Homeserver
self-hosted
Synapse Version
1.29.1
Installation Method
Other (please mention below)
Database
fresh postgresql 15.4 setup
Workers
Single process
Platform
archlinux arm
Configuration
No response
Relevant log output
2023-09-27 18:04:10,377 - synapse.http.server - 140 - ERROR - GET-660 - Failed handle request via 'WhoamiRestServlet': <XForwardedForRequest at 0
xffff94056e50 method='GET' uri='/_matrix/client/v3/account/whoami?user_id=%40whatsappbot%3Asir-photch.xyz' clientproto='HTTP/1.1' site='unix'>
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/synapse/http/server.py", line 326, in _async_render_wrapper
callback_return = await self._async_render(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/synapse/http/server.py", line 538, in _async_render
callback_return = await raw_callback_return
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/synapse/rest/client/account.py", line 851, in on_GET
requester = await self.auth.get_user_by_req(request, allow_guest=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/synapse/api/auth/internal.py", line 82, in get_user_by_req
requester = await self._wrapped_get_user_by_req(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/synapse/api/auth/internal.py", line 118, in _wrapped_get_user_by_req
ip_addr = request.getClientAddress().host
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'UNIXAddress' object has no attribute 'host'Anything else that would be useful to know?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
O-UncommonMost users are unlikely to come across this or unexpected workflowMost users are unlikely to come across this or unexpected workflowS-MinorBlocks non-critical functionality, workarounds exist.Blocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.Z-Help-WantedWe know exactly how to fix this issue, and would be grateful for any contributionWe know exactly how to fix this issue, and would be grateful for any contributiongood first issueGood for newcomersGood for newcomers