아래의 Parse JavaScript 코드를 실행하면 쿼리가 올바르게 작동합니다. 그러나 Parse 클라우드 코드로 실행되도록 코드를 조정하면 동일한 쿼리가 실행되지 않고 코드 콘텐츠를 테스트 할 때 코드 141로 오류가 발생합니다.Parse Cloudcode 쿼리 오류 141
여러 가지 점에서 두 기능을 모두 테스트했습니다. comp_id 및 request.params.comp_id 매개 변수는 동일합니다.
구문 분석 자바 스크립트 쿼리 (쿼리가 실행되지 않는 오류 141)
function testOne(comp_id) {
Parse.initialize(*****,*****);
var Competition = Parse.Object.extend("Competition");
var query = new Parse.Query(Competition);
console.log(query); // <~ gets a valid query
query.get(comp_id, {
success: function(competition) {
console.log(competition.id);
},
error: function(competition, error) {console.log(error);}
});
}
구문 분석 cloudcode 쿼리 (로컬로 실행 잘 작동합니다)
Parse.Cloud.define("testOneCloud", function(request, response) {
var comp_id = request.params.comp_id;
var Competition = Parse.Object.extend("Competition");
var query = new Parse.Query(Competition);
msg = query; // <~ gets undefined error 141
query.get(comp_id, {
success: function(competition) {
msg = competition.id; // <~query success code does not get executed
},
error: function(competition, error) {console.log(error);}
});
response.success(msg);
});
어떤 생각을 왜 이들 중 하나 두 개의 겉으로는 동일한 Parse 프로그램이 작동하고 다른 하나는 그렇지 않습니까?
그들은 동일하지 않습니다. 두 번째 변수는 정의되지 않은 msg 변수를 참조합니다. – danh