Login fails with error code 431

Hello.

I’m using MongoDB Realm Sync in a production environment.
Recently, some users fail to log in.
Looking at the server log at that time, the status of the login request is OK and it looks like there is no problem.
However, the client SDK is returning an error and the user is unable to log in.

Client code:

 app.login(credentials: Credentials.emailPassword(email: email, password: password)) { [weak self](result) in
            
            DispatchQueue.main.async {
              //  self!.setLoading();
                switch result {
                case .failure(let error):
                    Logger.shared.log("Login failed: \(error)");
                    failCallback(error, nil)
                    return
               
                case .success(let user):
                    print("Login succeeded!");
                    guard let `self` = self else { return }
                   
                   // some code....
                    
         }

Client log:

Login failed: Error Domain=realm::app::HttpError Code=431 "http error code considered fatal" UserInfo={realm::app::HttpError=Client Error: 431, NSLocalizedDescription=http error code considered fatal}
#Failed to login: http error code considered fatal
http error code considered fatal

I looked up the error code and it seems that the header of the request is too long.

Does anyone have any knowledge about this?

RealmSwift Version : 10.19.0
Mongo DB Atlas Version : 4.4.10

2 Likes

Do you have an example app that you can share that generates this error? It’s much easier to help if there’s something that we can reproduce.

1 Like

It seems that your User data is too big to be sent.

Hi, any new on this, I have the same problem using Realm with Flutter