使用下面的代码,我发现了这个错误:
{ code : 107, message : 'The server returned an invalid response.' }
at User.test.js:65
at User.test.js:60
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5269)
at reject (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5214)
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5281)
at reject (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5214)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5275
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5269)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5295
at runLater (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5286)
at then (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5296)
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5276)
at reject (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5214)
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5281)
at reject (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5214)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5275
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5269)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5295
at runLater (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5286)
at then (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5296)
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5276)
at reject (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5214)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5275
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5269)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5295
at runLater (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5286)
at then (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5296)
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5276)
at reject (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5214)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5259
at wrappedRejectedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5269)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5295
at runLater (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5286)
at then (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5296)
at wrappedResolvedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5260)
at resolve (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5193)
at wrappedResolvedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5262)
at resolve (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5193)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5257
at wrappedResolvedCallback (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5253)
at resolve (/Users/me/Documents/Developments/backend/bower_components/parse/parse.js:5193)
at /Users/me/Documents/Developments/backend/bower_components/parse/parse.js:8344
这是我的代码:
// MAIN.JS
Parse.Cloud.define('findUserWithUsername', function(request, response) {
console.log('MAIN => findUserWithUsername');
user.findUserWithUsername(request.params.username, response.success, response.error);
});
// USER.JS
exports.findUserWithUsername = function(username, success, failure) {
console.log('findUserWithUsername - username: ' + username);
Parse.Cloud.useMasterKey();
var query = new Parse.Query(Parse.User);
console.log('findUserWithUsername - query created')
query.equalTo("username", username).first().then(function(_user) {
if (typeof _user !== 'undefined') {
console.log('findUserWithUsername success -> ' + _user);
success(_user);
} else {
console.log('findUserWithUsername success -> no user found');
success(null);
}
}, function(_error) {
console.log('findUserWithUsername - error: ' + _error);
failure(_error);
});
}
// USER.TEST.JS
function deletePreviousUser(username) {
console.log('deletePreviousUser');
return Parse.Cloud.run("findUserWithUsername", {username: username}).then(function(user) {
console.log('findUserWithUsername succeed');
return (user == undefined) ? Parse.Promise.as() : Parse.Cloud.run("deleteUser", {userId: user.id});
}).then(function(result) {
return Parse.Promise.as();
}, function(_error) {
return Parse.Promise.error(_error);
});
}
我从未在Parse.com上收到过这样的错误消息,我也不知道这是什么意思。有什么建议吗?
答案 0 :(得分:13)
我遇到了同样的错误 如果没有修改代码,这个错误就会突然发生 在我的例子中,更改代码来自" response.success();" to"" response.success("");"解决了这个问题。
请尝试更改行"成功(null);" 成功("");"
答案 1 :(得分:1)
我有同样的问题,它通过重新启动Parse Local Server来解决。