Skip to content

JSON text did not start with array or object and option to allow fragments not set. #2517

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
shawn458 opened this issue Aug 14, 2016 · 4 comments

Comments

@shawn458
Copy link

Problem

I am getting the following response when I try to call [PFCloud callFunctionInBackground:] in my iOS app.

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.

My configuration in the AppDelegate looks like:
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) { configuration.applicationId = @"MY0PjsEc4aLZaWWoiYPnb4cju4VoKN7zyR41FPnR"; configuration.server = @"https://myappname.herokuapp.com/parse"; }]];

The interesting thing is Parse.Cloud.beforeSave function works as expected. Only when I am requested data back this issue appears.

Environment Setup

  • Server
    • parse-server version: 2.2.17
    • npm version: 3.8.6
    • node version: 4.3
    • parse-dashbboard version: 1.0.15
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Heroku
  • Database
    • MongoDB version: 3.0.9
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

Any help is appreciated

@shawn458
Copy link
Author

shawn458 commented Aug 14, 2016

Ignore

@shawn458
Copy link
Author

shawn458 commented Aug 16, 2016

I played around with this more and I am able to run a simple hello world cloud function. I get the

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.

when I run any function that returns something.

Here is the cloud code I am calling:

Parse.Cloud.define("test", function(request, response) {
    var query = new Parse.Query("TestClass");

    query.find({
        success: function(results) {
            response.success(results);
        }, error: function(theerror) {
            response.error("user lookup failed: %@", error);
            console.log(theerror);
        }
    }); 
});

@shawn458
Copy link
Author

Turns out I just wrote the Cloud Code wrong. Closing.

@wellkeptbeauty
Copy link

Parse.Cloud.define("test", function(request, response) {
var query = new Parse.Query("Classname");

query.find({
    success: function(results) {
        response.success(results);
                    console.log(results);

    }, error: function(theerror) {
        response.error("user lookup failed: %@", error);
        console.log(theerror);
    }
}); 

});

here is my cloud code , when i am calling this cloud code from application following error shows

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.}

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