解析服务器错误:代码= 3840

时间:2017-01-14 09:27:19

标签: parse-platform cloud-code

我有一个由Sashido托管的Parse服务器的应用程序 我尝试使用以下云功能,以获得用户的最高百分比:

Parse.Cloud.define(Constants.kParseFunctionGetPercentageOfUser, function(request, response) {
  var userRankQuery = new Parse.Query(Parse.User);
  userRankQuery.greaterThan(Constants.kClassUserKeyOverallLikes, request.params.likes);
  userRankQuery.count().then(function(count) {
    var rank = count + 1;
    console.info(Constants.kParseFunctionGetPercentageOfUser + " found rank: " + rank);
    var allUsersQuery = new Parse.Query(Parse.User);
    console.info("allUsersQuery: " + JSON.stringify(allUsersQuery));
    return allUsersQuery.count();
  }).then(function(nrAllUsers) {
    console.info("response.success: rank = " + rank + ", nrAllUsers = " + nrAllUsers);
    response.success(rank*100.0/nrAllUsers);
  }, function(error){
    console.info("response.error: " + error);
    response.error(Constants.kParseFunctionGetPercentageOfUser + " query failed: " + JSON.stringify(error));
  });
});  

我希望这个函数在语法上是正确的。

但是,Parse服务器仅记录2个语句

console.info(Constants.kParseFunctionGetPercentageOfUser + " found rank: " + rank);

console.info("allUsersQuery: " + JSON.stringify(allUsersQuery));  

然后似乎挂了。至少,它可能需要30秒,并在一些网络超时通知后,我收到错误:

errorError Domain=NSCocoaErrorDomain Code=3840 
"JSON text did not start with array or object and option to allow fragments not set."   

因此我想象Parse服务器挂起,超时后,我的应用程序出现此错误。

知道可能出现什么问题吗?

0 个答案:

没有答案
相关问题