Skip to content
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

Error Domain=NSCocoaErrorDomain Code=3840 #3126

Closed
4 tasks done
mkaya93 opened this issue Nov 27, 2016 · 7 comments
Closed
4 tasks done

Error Domain=NSCocoaErrorDomain Code=3840 #3126

mkaya93 opened this issue Nov 27, 2016 · 7 comments

Comments

@mkaya93
Copy link

mkaya93 commented Nov 27, 2016

--

I am getting this error when I'm trying to save object with big size image.

Optional(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.})

This is my code.

let object = PFObject(className: "Events")
        object.setObject(event!.title!, forKey: "title")
        object.setObject(event!.subTitle, forKey: "subtitle")
        object.setObject(event!.eventUser!, forKey: "eventAdmin")
        object.setObject(event!.locationGeoPoint!, forKey: "locationGeoPoint")
        object.setObject(event!.locationName!, forKey: "locationName")
        object.setObject(event!.venue?.foursquareId, forKey: "foursquareId")
        object.setObject(event!.eventStartDate!, forKey: "eventStartDate")
        object.setObject(event!.eventStartTime!, forKey: "eventStartTime")
        object.setObject(event!.whoIsPaying!, forKey: "whoIsPaying")
        object.setObject(event!.eventEndDate, forKey: "eventEndDate")
        object.setObject(event!.eventEndTime!, forKey: "eventEndTime")
        object.setObject(event!.eventCapacity, forKey: "eventCapactiy")
        object.setObject(event!.eventCategory, forKey: "eventCategory")
        object.setObject(event!.venue!.address, forKey: "eventAddress")
        object.setObject(self.descriptionTextField.text!, forKey: "subtitle")
        let fileData = UIImageJPEGRepresentation(event!.settedEventImage!, 0.6)
        let image = PFFile(data: fileData!, contentType: "image/jpeg")
        object.setObject(image, forKey: "eventImage")
        
        var relation = object.relation(forKey: "participants")
        relation.add(currentUser!)
       object.saveInBackground()

My parse server is working on Amazon Elastic BeansTalk.

@hramos
Copy link
Contributor

hramos commented Nov 29, 2016

Can you provide a curl command that reproduces this issue reliably on the latest Parse Server version?

@hramos hramos closed this as completed Feb 10, 2017
@PunkStarStudios
Copy link

This fails:
curl -X POST
-H "X-Parse-Application-Id: MyAPI"
-H "X-Parse-REST-API-Key: MyRest"
-H "Content-Type: image/jpg"
--data-binary '@1.jpg'
https://myserver.com/parse/files/1.jpg

This works
curl -X POST
-H "X-Parse-Application-Id: MyAPPId"
-H "X-Parse-REST-API-Key:MyRestAPI"
-H "Content-Type: image/jpg"
--data-binary '@1.jpg'
http://myserver.com:1337/parse/files/1.jpg

@flovilmart
Copy link
Contributor

probably because myserver.com doesn't respond on port 80. What's the error?

@PunkStarStudios
Copy link

PunkStarStudios commented Mar 13, 2017 via email

@flovilmart
Copy link
Contributor

So that's an issue with your nginx configuration, not an issue with parse-server.

@PunkStarStudios
Copy link

PunkStarStudios commented Mar 13, 2017 via email

@flovilmart
Copy link
Contributor

From there, it's a question that's more likely to be answered on stackoverflow, as it's not specific to parse-server but nginx and express apps

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

4 participants