parse-server: All Requests Receive Timeout Error

Environment Setup

  • Server: parse-server 2.2.10 (also tested on 2.2.9) , node 5.11.1, heroku
  • Database: mLab mongoDB 3.0.9

Steps to reproduce

I’m sorry this sucks, but we have not been able to narrow down the steps any more than this:

  1. Upload build to server
  2. Wait 5-15 minutes

Result: All requests begin timing out.

Code

Please note, this code does not appear to cause the problem as timeouts have begun without this ever running. However, I’ve been using this function when troubleshooting.

    console.log('running create!');
    //configure parameters
    var user = request.user;

    var title = request.params.title; //required
    var imageData = request.params.imageData; //required
    var videoData = request.params.videoData; //optional
    var content = request.params.content; //optional
    var attachment = request.params.attachment; //optional always URL

    //create a new story
    var newStory = new Story();
    //set the default parameters
    newStory.set("user", user);
    newStory.set("inspireCount", 0);
    newStory.set("commentCount", 0);
    newStory.set("viewCount", 0);
    newStory.set("notificationsOptOut", []);
    newStory.set("archived", false);
    newStory.set("toAllUsers", true);
    //add params that have been passed in
    newStory.set("title", title);
    newStory.set("content", content);
    newStory.set("attachment", attachment);
    //get the user's name and set it to the story
    var creatorName = user.get("name");
    newStory.set("creatorName", creatorName);

    //set the ACL
    newStory.setACL(createACLForStory(newStory));

    //this will be used to store promises when saving files
    var mediaFileSavePromises = [];
    //create image
    var image = new Parse.File("Image.jpg", imageData, "image/jpg");
    //save the image and push the promise into an array of promises
    mediaFileSavePromises.push(image.save());
    newStory.set("imageFile", image);

    //if there is a video
    if (videoData) {
        //create a file
        var video = new Parse.File("Video.mp4", videoData, "video/mp4");
        //save the file and push the promise onto the array
        mediaFileSavePromises.push(video.save());
        newStory.set("videoFile", video);
    }

    Parse.Promise.when(mediaFileSavePromises).then(function (mediaFiles) {
        //save the story
        console.log("media saved");
        return newStory.save();

    })
//more stuff. But never runs after timeouts start

Logs/Trace

Once timeouts begin I’m seeing this with VERBOSE enabled:

2016-05-20T20:18:26.942301+00:00 app[web.1]: verbose: GET /parse/classes/ClinkComment { host: '****.herokuapp.com',
2016-05-20T20:18:26.942311+00:00 app[web.1]:   connection: 'close',
2016-05-20T20:18:26.942313+00:00 app[web.1]:   'user-agent': 'node-XMLHttpRequest, Parse/js1.8.5 (NodeJS 5.11.1)',
2016-05-20T20:18:26.942313+00:00 app[web.1]:   accept: '*/*',
2016-05-20T20:18:26.942314+00:00 app[web.1]:   'content-type': 'text/plain',
2016-05-20T20:18:26.942317+00:00 app[web.1]:   'x-request-id': '9a7593e2-87c6-4e48-bc56-d1f9d05a0177',
2016-05-20T20:18:26.942318+00:00 app[web.1]:   'x-forwarded-for': '54.242.116.62',
2016-05-20T20:18:26.942319+00:00 app[web.1]:   'x-forwarded-proto': 'https',
2016-05-20T20:18:26.942319+00:00 app[web.1]:   'x-forwarded-port': '443',
2016-05-20T20:18:26.942320+00:00 app[web.1]:   via: '1.1 vegur',
2016-05-20T20:18:26.942320+00:00 app[web.1]:   'connect-time': '2',
2016-05-20T20:18:26.942321+00:00 app[web.1]:   'x-request-start': '1463775506929',
2016-05-20T20:18:26.942322+00:00 app[web.1]:   'total-route-time': '0',
2016-05-20T20:18:26.942322+00:00 app[web.1]:   'content-length': '349' } {
2016-05-20T20:18:26.942323+00:00 app[web.1]:   "where": {
2016-05-20T20:18:26.942324+00:00 app[web.1]:     "clink": {
2016-05-20T20:18:26.942324+00:00 app[web.1]:       "__type": "Pointer",
2016-05-20T20:18:26.942325+00:00 app[web.1]:       "className": "Clink",
2016-05-20T20:18:26.942325+00:00 app[web.1]:       "objectId": "B1vNrvL9sC"
2016-05-20T20:18:26.942326+00:00 app[web.1]:     }
2016-05-20T20:18:26.942327+00:00 app[web.1]:   },
2016-05-20T20:18:26.942327+00:00 app[web.1]:   "include": "user",
2016-05-20T20:18:26.942328+00:00 app[web.1]:   "limit": 25,
2016-05-20T20:18:26.942328+00:00 app[web.1]:   "order": "-createdAt"
2016-05-20T20:18:26.942329+00:00 app[web.1]: }
2016-05-20T20:18:26.696219+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/parse/classes/ClinkComment" host=***.herokuapp.com request_id=dcac6a25-54f5-42b0-b15e-dd43556a7a4a fwd="54.242.116.62" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2016-05-20T20:18:31.243011+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/parse/functions/fetchStories" host=***.herokuapp.com request_id=3d6c2b02-57f4-430c-b836-54563d5ace3f fwd="108.212.64.230" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2016-05-20T20:18:31.260092+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/parse/classes/Clink" host=***.herokuapp.com request_id=0fbf25bd-2def-43a3-81c3-c0e875950825 fwd="54.242.116.62" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0

If I wait around long enough I see this error:

2016-05-20T19:19:53.738611+00:00 app[web.1]: error! Received an error with invalid JSON from Parse: <!DOCTYPE html>
2016-05-20T19:19:53.738637+00:00 app[web.1]:     <html>
2016-05-20T19:19:53.738638+00:00 app[web.1]:     <head>
2016-05-20T19:19:53.738639+00:00 app[web.1]:       <meta name="viewport" content="width=device-width, initial-scale=1">
2016-05-20T19:19:53.738640+00:00 app[web.1]:       <style type="text/css">
2016-05-20T19:19:53.738641+00:00 app[web.1]:         html, body, iframe { margin: 0; padding: 0; height: 100%; }
2016-05-20T19:19:53.738643+00:00 app[web.1]:         iframe { display: block; width: 100%; border: none; }
2016-05-20T19:19:53.738643+00:00 app[web.1]:       </style>
2016-05-20T19:19:53.738645+00:00 app[web.1]:     <title>Application Error</title>
2016-05-20T19:19:53.738645+00:00 app[web.1]:     </head>
2016-05-20T19:19:53.738646+00:00 app[web.1]:     <body>
2016-05-20T19:19:53.738647+00:00 app[web.1]:       <iframe src="//s3.amazonaws.com/heroku_pages/error.html">
2016-05-20T19:19:53.738647+00:00 app[web.1]:         <p>Application Error</p>
2016-05-20T19:19:53.738648+00:00 app[web.1]:       </iframe>
2016-05-20T19:19:53.738648+00:00 app[web.1]:     </body>
2016-05-20T19:19:53.738649+00:00 app[web.1]:     </html>

Tested These Things

  • Spun up a new server instance. Still saw issue.
  • Waited until issue started and visited https://my-app.herokuapp.com/ and saw “I dream of being a website”
  • Added console.log statements in cloud code (above). Cloud functions get called even when requests are timing out. PFFiles are successfully saved. Nothing happens after newStory.save().
  • Enabled “log-runtime-metrics”. Memory usage was stable.
  • Restarted server. This solves the issue temporarily.
  • Rolled back to a previous deploy. This solved the issue. Diffed code between releases and saw only trivial changes. A few console.logs.

I’m very much at a loss for how to continue troubleshooting this problem. Thanks so much for your help!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 83 (19 by maintainers)

Commits related to this issue

Most upvoted comments

@pvlvsk you need to add "mongodb":"2.1.18" to your package json like in this example:

{
  "name": "parse-server-example",
  "version": "1.4.0",
  "description": "An example Parse API server using the parse-server module",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/ParsePlatform/parse-server-example"
  },
  "license": "MIT",
  "dependencies": {
    "express": "~4.11.x",
    "kerberos": "~0.0.x",
    "parse": "~1.8.0",
    "parse-server": "~2.2.2",
    "mongodb":"2.1.18"
  },
  "scripts": {
    "start": "node index.js"
  },
  "engines": {
    "node": ">=4.3"
  }
}

Hi @flovilmart,

The dependencies are as follows:

"dependencies": {
   "body-parser": "^1.15.1",
   "ejs": "^1.0.0",
   "express": "~4.11.x",
   "kerberos": "~0.0.x",
   "mandrill-api": ">=1.0.2",
   "parse": "~1.8.0",
   "parse-server": "~2.2.18",
   "mongodb":"2.1.18"
 }

We have changed the parse-server to 2.2.18 and hopefully it will work as expected. Will post anything if the problem occurs again.

The mongodb module doesn’t share a version number with the MobgoDB server. You don’t need to do anything, the module pinned at v2.1.18 supports MongoDB server v3.2 already.

https://docs.mongodb.com/ecosystem/drivers/node-js/#mongodb-compatibility

My own, broader, recommendation for how to prevent similar issues in the future is to ensure that your application uses pinned versions in your project’s package.json (or npm shrinkwrap) and then ensure that you can rollback easily to a previous deployment. Then, any issue caused by npm install picking a newer, broken package, will be fixed by your rollback, as the previous deploy will use the pinned version.

same here

Environment Setup

Server: parse-server 2.2.10, AWS Beanstalk Database: mLab mongoDB 3.0.9 Node Version: 4.4.3 Client is a react-native app.

I have only 50+ records in the database and only try to read them. After the first or second successful request, there is a timeout and the latency in the AWS Monitoring goes to 60 sec…

Ok, after few minutes the server not respond anymore, but show nothing on the logs (VERBOSE). Can be related with database, I’m installing the database locally now to see the logs too. Just to share ☺️