JSON text did not start with array or object and option to allow fragments not set.
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
Ignore
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);
}
});
});
Turns out I just wrote the Cloud Code wrong. Closing.
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.}