失败:success/error未被调用,尽管两个调用都在那里
Failed with: success/error was not called, despite both calls being there
我试图让我的解析云代码作业运行,但它一直给我一个错误说明Failed with: success/error was not called
,尽管这两个调用都在函数的末尾。我的设置是让他们永远不会接到电话吗?
Parse.Cloud.job("mcItemCount", function(request, response) {
// Query all users
var usersQuery = new Parse.Query(Parse.User);
// For each user in the DB...
return usersQuery.each(function(user) {
//Query all matchCenterItems associated with them
var matchCenterItem = Parse.Object.extend("matchCenterItem");
var mcItemQuery = new Parse.Query(matchCenterItem);
mcItemQuery.equalTo('parent', user);
// Set the numberOfItems property equal to the # of matchCenterItems they have
mcItemQuery.find().then(function(results) {
var numberOfItems = results.length;
user.set("numberOfItems", numberOfItems);
});
}.then(function() {
// Set the job's success status
response.success("mcItemsCount completed successfully.");
status.success("mcItemsCount completed successfully.");
}, function(error) {
// Set the job's error status
response.error('DAMN IT MAN');
status.error("mcItemsCount FAAAAIIILLED");
});
});
您似乎还没有定义status
。将函数定义中的response
参数替换为status
,然后删除response.success
和response.error
调用:
Parse.Cloud.job("mcItemCount", function(request, status) {
// Query all users
var usersQuery = new Parse.Query(Parse.User);
// For each user in the DB...
return usersQuery.each(function(user) {
// ...
}.then(function() {
// Set the job's success status
status.success("mcItemsCount completed successfully.");
}, function(error) {
// Set the job's error status
status.error("mcItemsCount FAAAAIIILLED");
});
});
相关文章:
- 另一个ajax调用中的Jquery ajax调用在for循环中没有按预期工作
- Ajax调用在Firefox中不会自动响应
- AJAX调用在chrome扩展中未成功
- jQueryAjax调用在单独的.js文件中不起作用
- 使用Ajax调用在服务器上实时更新页面
- 函数从$(document).ready外部调用在$(document).ready中定义的函数
- Ajax调用在InternetExplorer中冻结UI,但在firefox中运行良好
- 调用在同一视图中使用javascript在视图中创建的函数
- .ajax调用在chrome中不起作用
- 为什么 Javascript 和 AJAX 调用(在页面加载时)会导致数据库行为空?(脸书画布)
- 如何使用按钮来调用在画布中绘制的函数
- SPA异步调用在IE 11中不起作用
- node.js,async,restify:无法使restify调用在async.series内同步
- Web API 调用在设备模式下失败
- AJAX 调用在获得响应并成功执行时会冻结浏览器一段时间
- 我的函数调用在回显中不起作用
- 停止代码,直到 AJAX 调用在 $.each 循环中完成
- Ajax 调用在 IOS 中的用户交互之前不起作用
- ajax调用后,JQuery日历不工作,但按钮在那里
- 失败:success/error未被调用,尽管两个调用都在那里