ma1uta / ma1sd

Federated Matrix Identity Server (formerly fork of kamax/mxisd)
GNU Affero General Public License v3.0
167 stars 56 forks source link

3PID bind fails with synapse 1.1.0 #1

Closed mguentner closed 5 years ago

mguentner commented 5 years ago

I don't know when it last worked, but it worked at some point with that configuration.

Currently I am running mxisd 1.4.3 synapse 1.1.0 riot-web 1.2.1

When trying to attach an email to a user, the following requests are done:

POST /_matrix/client/r0/account/3pid HTTP/1.0

{"threePidCreds":{"sid":"XXXXXXXX08088","client_secret":"XXXXXXXXXXXXXXXXXXXXXXXXXXBbXBx2","id_server":"xxx"},"bind":true}

  GET /_matrix/identity/api/v1/3pid/getValidated3pid?sid=XXXXXXXX08088&client_secret=XXXXXXXXXXXXXXXXXXXXXXXXXXBbXBx2 HTTP/1.0
  Returns: 200 OK
  Content: {"medium":"email","address":"xxx@xxx","validated_at":1562509218632}

  POST /_matrix/identity/api/v1/3pid/bind HTTP/1.0
  sid=XXXXXXXX08088&client_secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXbXBx2&mxid=@xxx:xxx
  Returns 200 OK
  Result: {} (Empty JSON)

Returns: 500
Result: {"errcode":"M_UNKNOWN","error":"Internal server error"}

The GET and POST within the POST come from Synapse.

Relevant logs:

Jul 07 22:12:14 synapse[8337]: synapse.http.client: [POST-3805] Sending request POST https://xxx/_matrix/identity/api/v1/3pid/bind
Jul 07 22:12:14 mxisd[2538]: [XNIO-1 task-5] INFO io.kamax.mxisd.session.SessionManager - Session 15625
29899056: Binding of email:xxx@xxx to Matrix ID @xxx:xxx is accepted
Jul 07 22:12:14 synapse[8337]: synapse.http.client: [POST-3805] Received response to POST https://xxx/_matrix/identity/api/v1/3pid/bind: 200
Jul 07 22:12:14 synapse[8337]: synapse.http.server: [POST-3805] Failed handle request via 'ThreepidRest
Servlet': <XForwardedForRequest at 0x7fae853f5860 method='POST' uri='/_matrix/client/r0/account/3pid' clientproto='HTTP/1.0' site=800
8>
                                                            Traceback (most recent call last):
                                                               File "/nix/store/j5pz84glsnnsx7gks2ny91w4an40i4wg-python3.7-Twisted-18
.9.0/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
                                                                 result = g.send(result)
                                                               File "/nix/store/48dl4n1qh7wbpsi18kq1yjdj9rzh66mq-matrix-synapse-1.1.0
/lib/python3.7/site-packages/synapse/http/client.py", line 348, in post_urlencoded_get_json
                                                                 defer.returnValue(json.loads(body))
                                                               File "/nix/store/j5pz84glsnnsx7gks2ny91w4an40i4wg-python3.7-Twisted-18
.9.0/lib/python3.7/site-packages/twisted/internet/defer.py", line 1362, in returnValue
                                                                 raise _DefGen_Return(val)
                                                             twisted.internet.defer._DefGen_Return: {}

                                                             During handling of the above exception, another exception occurred:

                                                             Traceback (most recent call last):
                                                               File "/nix/store/48dl4n1qh7wbpsi18kq1yjdj9rzh66mq-matrix-synapse-1.1.0
/lib/python3.7/site-packages/synapse/http/server.py", line 76, in wrapped_request_handler
                                                                 await h(self, request)
                                                               File "/nix/store/48dl4n1qh7wbpsi18kq1yjdj9rzh66mq-matrix-synapse-1.1.0
/lib/python3.7/site-packages/synapse/http/server.py", line 301, in _async_render
                                                                 callback_return = await callback_return
                                                               File "/nix/store/j5pz84glsnnsx7gks2ny91w4an40i4wg-python3.7-Twisted-18
.9.0/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
                                                                 result = result.throwExceptionIntoGenerator(g)
                                                               File "/nix/store/j5pz84glsnnsx7gks2ny91w4an40i4wg-python3.7-Twisted-18
.9.0/lib/python3.7/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
                                                                 return g.throw(self.type, self.value, self.tb)
                                                               File "/nix/store/48dl4n1qh7wbpsi18kq1yjdj9rzh66mq-matrix-synapse-1.1.0
/lib/python3.7/site-packages/synapse/rest/client/v2_alpha/account.py", line 569, in on_POST
                                                                 yield self.identity_handler.bind_threepid(threePidCreds, user_id)
                                                               File "/nix/store/j5pz84glsnnsx7gks2ny91w4an40i4wg-python3.7-Twisted-18
.9.0/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
                                                                 result = g.send(result)
                                                               File "/nix/store/48dl4n1qh7wbpsi18kq1yjdj9rzh66mq-matrix-synapse-1.1.0
/lib/python3.7/site-packages/synapse/handlers/identity.py", line 130, in bind_threepid
                                                                 medium=data["medium"],
                                                             KeyError: 'medium'
mguentner commented 5 years ago

I should have updated to the latest release of mxisd as this includes fixes for synapse >= 0.99.4