parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Error with Code 3840 after switching to parse server on Amazon Elastic Beanstalk

Open candork opened this issue 10 years ago • 3 comments

I have parse installed on AWS Elastic Bean Stalk with database on mLab.

I get this error when running the app on iOS (objective c). 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.}

Here are the error logs from the server

/var/log/nginx/error.log

2016/05/02 13:42:15 [error] 3188#0: *142495 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: , server: , request: "POST /parse/classes/Comment HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/Comment", host: "api.snapchat.com"

2016/05/02 13:42:15 [error] 3188#0: *142486 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: , server: , request: "POST /parse/classes/SoundData/l8Kkl0B3NK HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/SoundData/l8Kkl0B3NK", host: "hidden-prefix.us-east-1.elasticbeanstalk.com"

2016/05/02 13:42:18 [error] 3188#0: *142486 connect() failed (111: Connection refused) while connecting to upstream, client: , server: , request: "POST /parse/classes/Comment HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/Comment", host: "api.snapchat.com"

2016/05/02 13:42:19 [error] 3188#0: *142517 connect() failed (111: Connection refused) while connecting to upstream, client: , server: , request: "POST /parse/functions/FeedCloudFunction_getFeedOfUser HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/functions/FeedCloudFunction_getFeedOfUser", host: "api.snapchat.com"

2016/05/02 13:42:33 [error] 3188#0: *142508 upstream prematurely closed connection while reading response header from upstream, client: 10.180.203.86, server: , request: "POST /parse/classes/SoundData/3NbbVRJIIo HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/SoundData/3NbbVRJIIo", host: "hidden-prefix.us-east-1.elasticbeanstalk.com"

2016/05/02 13:42:33 [error] 3188#0: *142508 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.180.203.86, server: , request: "POST /parse/classes/SoundData/3NbbVRJIIo HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/SoundData/3NbbVRJIIo", host: "hidden-prefix.us-east-1.elasticbeanstalk.com"

2016/05/02 13:42:33 [error] 3188#0: *142508 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.180.203.86, server: , request: "POST /parse/classes/SoundData/3NbbVRJIIo HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/SoundData/3NbbVRJIIo", host: "hidden-prefix.us-east-1.elasticbeanstalk.com"

2016/05/02 13:43:01 [error] 3188#0: *142550 upstream prematurely closed connection while reading response header from upstream, client: , server: , request: "GET /parse/classes/_User/ihSR4oZH5i HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/_User/ihSR4oZH5i", host: "api.snapchat.com"

2016/05/02 13:43:01 [error] 3188#0: *142552 upstream prematurely closed connection while reading response header from upstream, client: , server: , request: "POST /parse/classes/_User/p8WZn7NLL6 HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/_User/p8WZn7NLL6", host: "hidden-prefix.us-east-1.elasticbeanstalk.com"

2016/05/02 13:43:01 [error] 3188#0: *142562 upstream prematurely closed connection while reading response header from upstream, client: 10.180.203.86, server: , request: "POST /parse/config HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/config", host: "hidden-prefix.us-east-1.elasticbeanstalk.com"

candork avatar May 02 '16 14:05 candork

Did you ever figure this out? I have the same issue.

petermulsh avatar May 06 '16 14:05 petermulsh

@petermulsh I figured this one out. For me, there was an error in my cloud code, I had an after save function that was sending push notification. I was using Amazon SNS for push and the server was crashing on that function. I solved it by using parse for push notifications.

Look into your cloud code and see if some function is failing. You can run it locally first and monitor the logs. To get detailed logging you can turn on verbose, eg:

var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'hidden', masterKey: process.env.MASTER_KEY || 'hidden', verbose: true });

candork avatar May 07 '16 07:05 candork

Please update to the latest version, and let us know if the error still occurs.

flovilmart avatar Jun 05 '16 17:06 flovilmart