parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.91k stars 4.78k forks source link

Issues storing Arrays on _User collection. #1500

Closed Jerland2 closed 8 years ago

Jerland2 commented 8 years ago

I have the following code attempting to log a user in, I have double checked that the user is currently logged out. Here is the code trying to sign the suer in.

` print("START LOGIN PROCESS") PFUser.logInWithUsernameInBackground(username!, password: password!, block: { (user, error) -> Void in if ((user) != nil) {

                let alert = UIAlertView(title: "Success", message: "Logged In", delegate: self, cancelButtonTitle: "OK")
                alert.show()

                print("LOGGED IN")

                self.performSegueWithIdentifier("loginToTabbar", sender: self)

            } else {
                print("CANNOT LOGIN")

                let alert = UIAlertView(title: "Invalid Login Credentials", message: "Invalid Email Address or Password.", delegate: self, cancelButtonTitle: "OK") //Previous message \(error)
                alert.show()

            }
        })

`

If the username and password do not match an account on parse server it returns saying invalid credentials, HOWEVER when the username and password are correct it throws the following:

Removed For Security

Problem

Login in background with block not executing server side

How to replicate

Store Arrays in _User Class in Parse, in this case an array of Strings `let user = PFUser.currentUser()! user["array1"] = array1 user["array2"] = array2 user["array3"] = array3

    user.saveInBackgroundWithBlock {
        (succeeded: Bool, error: NSError?) -> Void in
        if let error = error {
            _ = error.userInfo["error"] as? NSString
            print("failed")

        } else {

print("Sucess") }

    }

}

`

Solution

Do not have any Arrays stored in _User class

drew-gross commented 8 years ago

To help us debug this, can you include the exact request and response in Parse Server? (you can see this in the logs using VERBOSE=1 environment variable)

Jerland2 commented 8 years ago

I am not familiar with setting environmental variables. I have gone to Product->Scheme->Edit Scheme->Select Run->Arguments and set Environmental Variables to Name: "VERBOSE" and Value: "1" however the console output looked the exact same, perhaps you could help me with whatever step I am missing? Thanks

drew-gross commented 8 years ago

when you run your Parse Server, use VERBOSE=1 parse-server or whatever command you use to run Parse Server

Jerland2 commented 8 years ago

Im not sure how to do this, I have parse server running with Heroku, so I dont use a command to start the server, it is always running. I should clarify the above error code was in Xcode.

drew-gross commented 8 years ago

There should be a UI in Heroku that lets you set environment variables.

Jerland2 commented 8 years ago

I got the live log running using terminal command heroku logs -t and when I make the request I receive

Removed for security purposes

This is even more confusing to me because it doesn't seem to throw any errors....

drew-gross commented 8 years ago

Those are heroku logs. You also need to enable Parse Server logs.

Jerland2 commented 8 years ago

Working on enabling them now, having issues locating the logs. I have set Name: "VERBOSE" to value: "1" as a config var on heroku, now I am just trying to figure out where these logs would be, they are not in my git directory.

Jerland2 commented 8 years ago

Okay, finally found out how to view Parse Logs here is the output (WIth VERBOSE = 1):

Removed for Security

NOTE: For security I have changed some details such as app name to and username to

EDIT: SO I have been thinking of why this is happening and the only new thing that I have been trying since I used Parse last (When it was hosted at Parse.com) is that I am storing 3 arrays in the _User class. Maybe this isnt supported? I have not tried to remove this, but I will try soon when I get back to the office.

EDIT2: THIS HAVE SOLVED THE PROBLEM! Apparently you cannot store arrays in the default )User class. This is disappointing, i wonder if anyone has found a way around it.

drew-gross commented 8 years ago

Storing arrays on the _User collection should work just as well as storing arrays on any other collection. We'll investigate whats causing that. The logs, if you've found them, would still be helpful for that.

flovilmart commented 8 years ago

Closing due to lack of activity, please reopen if the issue persist.

Don't forget to include your current: