matrix-org / matrix-org/matrix-ios-sdk

Inviting someone to join a room is failing with internal server error

Open
#703 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
484
Forks
225
PR merge metrics
No merged PRs in 30d

Description

Hi everybody. I'm trying to build a quick proof of concept app using Matrix iOS SDK, and a LOT of it works great... however, I cannot **invite** anybody to join a room. When I do, I get an 'internal server error' -- we think we narrowed it down. It seems the iOS SDK adds a 'content length' to the HTTP header. When our backend guy adds that header, he gets a timeout. If he removes it, the invite goes in just fine. Any help on this issue would be great. -- This might not actually be the issue though since other requests work fine with this added content length by the SDK

Logs:

```
2019-07-31 12:17:25.784706-0400 matrix-ios-poc[86863:1411173] [MXHTTPClient] Request 0x600000ce9040 failed for path: _matrix/client/r0/rooms/!bALyQDpznIqtQSzwgH:ec2-52-23-239-78.compute-1.amazonaws.com/invite - HTTP code: 500. Error: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)" UserInfo={NSLocalizedDescription=Request failed: internal server error (500), NSErrorFailingURLKey=http://[REDACTED]/_matrix/client/r0/rooms/!bALyQDpznIqtQSzwgH:ec2-52-23-239-78.compute-1.amazonaws.com/invite, com.alamofire.serialization.response.error.data=<7b226572 72636f64 65223a22 4d5f554e 4b4e4f57 4e222c22 6572726f 72223a22 496e7465 726e616c 20736572 76657220 6572726f 72227d>, com.alamofire.serialization.response.error.response= { URL: http://[REDACTED]/_matrix/client/r0/rooms/!bALyQDpznIqtQSzwgH:ec2-52-23-239-78.compute-1.amazonaws.com/invite } { Status Code: 500, Headers {
"Access-Control-Allow-Headers" = (
"Origin, X-Requested-With, Content-Type, Accept, Authorization"
);
"Access-Control-Allow-Methods" = (
"GET, POST, PUT, DELETE, OPTIONS"
);
"Access-Control-Allow-Origin" = (
"*"
);
"Cache-Control" = (
"no-cache, no-store, must-revalidate"
);
"Content-Length" = (
55
);
"Content-Type" = (
"application/json"
);
Date = (
"Wed, 31 Jul 2019 16:17:22 GMT"
);
Server = (
"Synapse/1.2.1"
);
} }}
2019-07-31 12:17:25.785152-0400 matrix-ios-poc[86863:1411173] [MXHTTPClient] Error JSONResponse: {
errcode = "M_UNKNOWN";
error = "Internal server error";
}
2019-07-31 12:17:25.785380-0400 matrix-ios-poc[86863:1411173] [MXHTTPClient] cleanupBackgroundTask
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the room invite request described in the logs and inspect how the iOS SDK sends the Content-Length header to the /_matrix/client/r0/rooms/.../invite endpoint. Compare invite behavior with the other requests mentioned and determine whether the failure is in the SDK or the Synapse backend. Done means the invite request completes without the reported 500 error or timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
mobile-dev, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.