You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JSON text did not start with array or object and option to allow fragments not set. #166
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.
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 createdWith property 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.
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.
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
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?
Reacted by Hamit Soyel, James Matthew Mudgett, Romy, MezzoSoprano and julianiaccopucci
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.
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.}
I am getting the same error after moving the mandrill initializer to the top of the cloud code:
Error loggin in: 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.}
// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
var Mandrill = require('mandrill-api/mandrill');
Mandrill.initialize('XXXXXXXXXXXXXXXXXXXXX');
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world!");
});
Parse.Cloud.define("sendMail", function(request, response) {
// Moved this line to the top
// var Mandrill = require('mandrill-api/mandrill');
// Mandrill.initialize('XXXXXXXXXXXXXXXXXXXXX');
Mandrill.sendEmail({
message: {
text: request.params.text,
subject: request.params.subject,
from_email: request.params.fromEmail,
from_name: request.params.fromName,
to: [
{
email: request.params.toEmail,
name: request.params.toName
}
]
},
async: true
},{
success: function(httpResponse) {
console.log(httpResponse);
response.success("Email sent");
},
error: function(httpResponse) {
console.error(httpResponse);
response.error("Email not sent");
}
});
});
Before that I was getting:
[Error]: {"code":1,"message":"Internal server error."} (Code: 1, Version: 1.13.0)
I am Also got the same issues in JSON parisng.i am new to swift code so i don't know how to fix this issues. please help me to fix this issues
"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 call cloud function from Xcode, getting following result
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.}
I've been stuck for 3 weeks with this problem. It happens when I call saveInBackgroundWithBlock in parse ios sdk. I get the same connection refused in my logs as candork does. I am desperate to fix this. Our app is completely blocked. It's completely random and I cannot reproduce it using any steps. Sometimes it fails, sometimes it doesn't. It appears to only happen in ios11. There is no change in ios code and it has been working fine for 2 years, then all of a sudden....
@ArchonLight If you can provide details/logs of the specific request causing the error, and any relevants logs server side, that would be most helpful.
This is likely to be caused by a 5xx error on the server, or an uncaught exception that would make the error not being properly set in the response. OR a response from a proxy, that terminated the connection without responding with a JSON response.
[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.}
Is it always marked first by upstream prematurely closed connection while reading response header from upstream, with the following connections refused? That does seem a lot like a crash :/. It would definitely help to see the corresponding parse-server logs.
Activity
gfosco commentedon Feb 2, 2016
This is pointing at api.parse.com instead of a parse-server instance, but I'm curious if @nlutsenko sees anything else strange here.
jaydeep82 commentedon Feb 2, 2016
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 ?
nlutsenko commentedon Feb 2, 2016
Few things:
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.nlutsenko commentedon Feb 2, 2016
Hope this helps, let us know if there is anything we missed or anything that is not quite clear.
jaydeep82 commentedon Feb 2, 2016
Hi Nikita, thank you very much for your quick reply.
Regarding second issue, this class/collection
_Sessionis part of my Parse Application and generated by Parse. Actually I've migrated this data from Parse to Mongodb hosted on MongoLab.I've not done any manual changes in
_Sessionschema. Is this schema mismatch issue because of database migration from parse to mongodb ?latne1ec commentedon Feb 2, 2016
Adding /parse to the end of my configuration.server url worked for me.
jaydeep82 commentedon Feb 3, 2016
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.
latne1ec commentedon Feb 3, 2016
I set up an ec2 instance on aws to host my mongodb database and heroku for the parse-server api.
flovilmart commentedon Feb 6, 2016
@gfosco isn't the API URL for parse
https://api.parse.com/1/KathleenFMalone commentedon Mar 9, 2016
I had the same problem and added parse at the end of the server URL and it worked. Thank you latne1ec!!!!
michael-mckenna commentedon Mar 19, 2016
/parse at the end of the url worked for me too.
rendragon83 commentedon Mar 22, 2016
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
and I also tried:
let configuration = ParseClientConfiguration {
$0.applicationId = "appID"
$0.clientKey = "appMasterKey"
$0.server = "https://MyAppName.herokuapp.com/parse"
}
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?
bchapin commentedon Apr 20, 2016
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 configuration) {
configuration.applicationId = @"xxxxx";
//configuration.clientKey = @"";
configuration.server = @"http://myappname.heroku.com/parse";
}]];
It all works fine when pointing to the parse servers
Any help? Suggestions?
6 remaining items
candork commentedon May 2, 2016
Getting the same problem. I have parse installed on AWS Elastic Bean Stalk with database on mLab.
This happens very randomly.
candork commentedon May 2, 2016
Here are the error logs from the server
jrespuny commentedon May 23, 2016
I am getting the same error after moving the mandrill initializer to the top of the cloud code:
Error loggin in: 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.}
Before that I was getting:
[Error]: {"code":1,"message":"Internal server error."} (Code: 1, Version: 1.13.0)
when calling the sendMail function
kumareshsaran commentedon Mar 30, 2017
I am Also got the same issues in JSON parisng.i am new to swift code so i don't know how to fix this issues. please help me to fix this issues
"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.}"
wellkeptbeauty commentedon Apr 27, 2017
when i call cloud function from Xcode, getting following result
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.}
flovilmart commentedon May 6, 2017
@wellkeptbeauty can you open a new issue with all required details?
giusecapo commentedon Jun 14, 2017
@wellkeptbeauty same here, how did you fix?
AnAppDev01 commentedon Nov 3, 2017
I've been stuck for 3 weeks with this problem. It happens when I call saveInBackgroundWithBlock in parse ios sdk. I get the same connection refused in my logs as candork does. I am desperate to fix this. Our app is completely blocked. It's completely random and I cannot reproduce it using any steps. Sometimes it fails, sometimes it doesn't. It appears to only happen in ios11. There is no change in ios code and it has been working fine for 2 years, then all of a sudden....
montymxb commentedon Nov 3, 2017
@ArchonLight If you can provide details/logs of the specific request causing the error, and any relevants logs server side, that would be most helpful.
flovilmart commentedon Nov 3, 2017
This is likely to be caused by a 5xx error on the server, or an uncaught exception that would make the error not being properly set in the response. OR a response from a proxy, that terminated the connection without responding with a JSON response.
AnAppDev01 commentedon Nov 3, 2017
My object to save in mongoDB:
Printing description of photo:
my ios code:
Console Error:
AWS EB log errors:
^ and a bunch more just like it
flovilmart commentedon Nov 3, 2017
what about your parse-server logs? did the process crash?
Because: 60670 connect() failed (111: Connection refused) while connecting to upstream
montymxb commentedon Nov 3, 2017
Is it always marked first by
upstream prematurely closed connection while reading response header from upstream, with the following connections refused? That does seem a lot like a crash :/. It would definitely help to see the corresponding parse-server logs.