Skip to content

saveInBackground method causes error: The data couldn’t be read because it isn’t in the correct format. #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
agordeev opened this issue Jul 4, 2016 · 3 comments

Comments

@agordeev
Copy link

agordeev commented Jul 4, 2016

Issue Description

I have a class called Image, which has image property of PFFile type. When I'm trying to create a new object by calling saveInBackground method, the server returns this error:

Error Domain=NSCocoaErrorDomain Code=3840 
"JSON text did not start with array or object and option to allow fragments not set." 
UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

error.localizedDescription:

The data couldn’t be read because it isn’t in the correct format.

Save operations on other classes work fine. The server log doesn't even show that there is POST request to Image class.

Any ideas what's wrong?

Environment Setup

Parse SDK version: 1.13.0
Bolts: 1.7.0

  • Server
    • parse-server version: 2.2.14.
    • parse-dashboard version: 1.0.14
    • Operating System: Ubuntu 10.14
@agordeev
Copy link
Author

agordeev commented Jul 4, 2016

Also this cloud code doesn't work as well:

var query = new Parse.Query("UserProfile");
query.equalTo("objectId", userProfileId);
query.first().then(function(userProfile) {
    ///...
},
function(error) {
  response.error("code=" + error.code + ": " + error.message);
});

Returns this error:

code=107: Received an error with invalid JSON from Parse: Cannot POST /parse/classes/UserProfile

@agordeev
Copy link
Author

agordeev commented Jul 5, 2016

Seems like the issue was related to wrong serverURL variable in server configuration file.

@omarojo
Copy link

omarojo commented Aug 13, 2020

How come you were successfully saving other Classes, but that one was failing. And it turned out to be the serverURL ?
I have the same issue, but my URLs are fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants