Skip to content

Identity server errors during 3PID invite cause 500 internal server error #19257

@svajunas-budrys

Description

@svajunas-budrys

Description

When an identity server returns a non-2xx response (my case: 400, M_THREEPID_IN_USE) to Synapse's /store-invite request during a 3PID invite, Synapse returns a 500 internal server error with M_UNKNOWN instead of handling the error and returning an appropriate 4xx response. Because the server always returns a generic 500 M_UNKNOWN here, it’s difficult for clients to implement good UX for this case.

Steps to reproduce

  • Make the identity server return 400 for /store-invite requests
  • Do the request
  • Synapse returns a 500 internal server error with M_UNKNOWN instead of handling the identity server's error response.

Homeserver

On private homeserver

Synapse Version

1.140.0

Installation Method

Other - Helm chart

Database

PostgreSQL 17.6

are you using a single PostgreSQL server or separate servers for main and state?
Single

have you previously ported from SQLite using the Synapse "portdb" script?
No

have you previously restored from a backup?
No

Workers

Multiple workers

Platform

In self-managed k8s in Ubuntu 24.04.3 VM (AMD) cluster

Relevant log output

{"log":"Failed handle request via 'RoomMembershipRestServlet': <XForwardedForRequest at 0x7e097a918e00 method='POST' uri='/_matrix/client/v3/rooms/!SFSEJVodkvUDxGipWt%3Ahomeserver.xx/invite' clientproto='HTTP/1.1' site='8083'>","namespace":"synapse.http.server","level":"ERROR","time":1764584153.74,"request":"POST-1566538","server_name":"homeserver.xx","ip_address":"11.11.11.11","site_tag":"8083","requester":"@65349:homeserver.xx","authenticated_entity":"@65349:homeserver.xx","method":"POST","url":"/_matrix/client/v3/rooms/!SFSEJVodkvUDxGipWt%3Ahomeserver.xx/invite","protocol":"HTTP/1.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","exc_type":"HttpResponseException","exc_value":"400: Bad Request"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions