JSON text did not start with array or object and option to allow fragments not set.
Hello Friends,
I've migrated the parse-server code on my aws ec2 server. Before testing to my code, I've tried to connect to parse server as mentioned below.
Parse.initializeWithConfiguration(ParseClientConfiguration(block: { ( configuration : ParseMutableClientConfiguration ) -> Void in configuration.applicationId = PARSE_DEVELOPMENT_APPLICATION_ID configuration.clientKey = PARSE_DEVELOPMENT_CLIENT_KEY configuration.server = "https://api.parse.com" }))
I have used Parse (1.12.0) SDK in this App.
When I start my iOS App, I'm getting following error message.
2016-02-02 12:42:59.684 MyParseApp[5101:61497] [Error]: Failed to run command eventually with 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.}
Could you assist me here what is wrong ? Any suggestion/assistance would be highly appreciated.
Thank you.
This is pointing at api.parse.com instead of a parse-server instance, but I'm curious if @nlutsenko sees anything else strange here.
Thank you Fosco for quick reply.
I've migrated the code to my aws ec2 server and database on mongolab.
Using curl, I'm able to call the cloud function, insert data in mongodb, get data from mongodb.
But in iOS(Swift) App, I'm getting following error message :
2016-02-02 11:39:59.718 MyApp[4168:43783] [Error]: schema mismatch for _Session.createdWith; expected map but got object (Code: 111, Version: 1.12.0) error in register : schema mismatch for _Session.createdWith; expected map but got object
is it different issue ?
Few things:
- Error 3840 means that we couldn't parse out the JSON response back from the server. I would recommend adding logging on the server end of things and looking into request/response trace for this call.
- The second one is actually a client-propagation of the server error. Looks like you have a different schema already set for the
createdWithproperty on the_Session. Looks like at some point it received a map, instead of a Parse Object and now it fails to validate since the schema is already set. I would recommend taking a look at the _Session collection object schema and making the adjustment either on the server or on the client.
Hope this helps, let us know if there is anything we missed or anything that is not quite clear.
Hi Nikita, thank you very much for your quick reply.
Regarding second issue, this class/collection _Session is part of my Parse Application and generated by Parse. Actually I've migrated this data from Parse to Mongodb hosted on MongoLab.
"createdWith" : {
"action" : "login",
"authProvider" : "password"
}
I've not done any manual changes in _Session schema. Is this schema mismatch issue because of database migration from parse to mongodb ?
Adding /parse to the end of my configuration.server url worked for me.
Hi @latne1ec , Thank you for your reply.
Could you share more details about which platform you have used for parse deployment ? I've used heroku and mongolab.
I've also added /parse to the end of my configuration.server url.
I set up an ec2 instance on aws to host my mongodb database and heroku for the parse-server api.
@gfosco isn't the API URL for parse https://api.parse.com/1/
I had the same problem and added parse at the end of the server URL and it worked. Thank you latne1ec!!!!
/parse at the end of the url worked for me too.
I added /parse and it is not working for me. I have the same issues as @jaydeep82, I am also using Heroku with mongolab. I have tried two different ways to do this in swift, but I still get the same error. These are the two ways I have done it:
let configuration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "appID"
ParseMutableClientConfiguration.clientKey = "appMasterKey"
ParseMutableClientConfiguration.server = "https://MyAppName.herokuapp.com/parse"
})
Parse.initializeWithConfiguration(configuration);
and I also tried:
let configuration = ParseClientConfiguration { $0.applicationId = "appID" $0.clientKey = "appMasterKey" $0.server = "https://MyAppName.herokuapp.com/parse" }
Parse.initializeWithConfiguration(configuration)
Both ways I still get error code of 3840 "JSON text did not start with array or object and option to allow fragments not set."
2016-03-24 11:20:31.538 ClockIn[4668:676920] Warning: A long-running operation is being executed on the main thread. Break on warnBlockingOperationOnMainThread() to debug. 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.}
Either of these work if I use https://api.parse.com/1/ for the server, but does not work if I try to use my own server. Does anyone know why this is happening, or is it just broken when using iOS and swift?
I just tried migrating my app to Heroku. Some things work, others do not. I am getting the error "JSON text did not start with array or object and option to allow fragments not set" when saving objects.
My app is configured using:
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id
It all works fine when pointing to the parse servers
Any help? Suggestions?
I am now getting the same issue as @bchapin
Can you open a new issue and include some logs for what exactly is happening? We can't debug with such a vague description.
Is there a new issue for this ? I am facing the same issue and pretty much stuck .. Is there a solution for this ?
Exact same issue for me as @rendragon83 , competely stuck. If anyone managed to sort this please comment.
Any solution for this will be greatly appreciated ,,, we are stuck
+1 Got the same problem. But with PFCloud.callFunctionInBackground()
Getting the same problem. I have parse installed on AWS Elastic Bean Stalk with database on mLab.
This happens very randomly.
2016-05-02 09:43:43.631 app[1387:388806] [Error]: Failed to run command eventually with 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.}
2016-05-02 09:43:43.694 app[1387:388806] [Error]: Failed to run command eventually with 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.}
2016-05-02 09:43:43.755 app[1387:388806] [Error]: Failed to run command eventually with 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.}