Search code examples
swiftrealmcloudkitrealm-object-server

Realm Object Server - Error: Your request parameters did not validate


I built a small iOS application which uses Realm instead of CoreData. The app does not require a login as it only stores data entered by the user. I'm currently trying to save users data so that if a user deleted the app for example, the data will be there by default the next the app is re-installed.

Here's where I am getting confused. Can I still use Realm Mobile Platform even though the app will not require a login screen. (i.e. data will automatically be saved for users who are logged-in to their iCloud accounts).

Here's what I've done so far:

  1. I configured Realm Object Server on an AWS EC2 instance, and I can login to the realm dashboard through the browser just fine.
  2. I configured the cloudKit stanza in the configuration.yml file as per the authentication instructions.
  3. In my setupRealm() func, I tried the following code but I keep getting a parameters validation error:

    SyncUser.logIn(with: cloudKitCredentials,
                   server: serverURL) { user, error in
                    if let user = user {
                        print("in")
                    }
    
                    else if let error = error {
                        fatalError(String(describing: error))
                        // Error: "Your request parameters did not validate."
                    }
    

    This is the error message:

    Error Domain=io.realm.sync Code=3 
    "Your request parameters did not validate." 
    UserInfo={statusCode=400, 
              NSLocalizedDescription=Your request parameters did not validate.}:
    

I suspect that the my iCloud user is not being tied with the object server, but I can't seem to put the pieces together. I'd appreciate any pointers.



Solution

  • The server requires a restart after editing the authentication lines in the configuration.yml.