解析失败,出现: 类型错误: 无法读取未定义的属性“成功”

Parse Failed with: TypeError: Cannot read property 'success' of undefined

本文关键字:读取 未定义 属性 成功 失败 出现 错误 类型      更新时间:2023-09-26

我一直收到此错误失败,并显示: 类型错误: 无法读取未定义的属性"成功",我无法找出问题

Parse.Cloud.httpRequest(
{
    url:url,
    success:function(httpResponse)
    {
      var Day = Parse.Object.extend("TestDay");
      var queryToday = new Parse.Query(Day);
      queryToday.equalTo("dayday", day);
      queryToday.equalTo("daymonth", month);
      queryToday.equalTo("dayyear", year);
      queryToday.equalTo("owner", theUser);
      queryToday.first().then(function(dayObject)  <---line 662
      {
         if(dayObject == undefined)
         {
           console.log("not found");
         }
         else
         {
           console.log(dayObject);
         }
      }, function(error)
      {
          console.log("first failed");
      });
    }
 });

失败,出现: 类型错误: 无法读取未定义的属性"成功" at Object.b.Query.first (Parse.js:1:57000) at Object.Parse.Cloud.httpRequest.success (main.js:662:48)

你怎么知道那是这条线?我的意思是,您是否使用控制台在网络上?

还有什么要知道的吗?就像您正在处理云功能一样?

我的猜测是返回dayObject.save();不起作用。尝试使用console.log(dayObject)来准确了解查询的响应。您可能必须使用条件,如下所示:

if(dayObject == undefined){
    return Parse.Promise.error("Not Found");
}else{
    dayObject.increment("totalnumberofphotos");
    return dayObject.save();
}

我已经找到了问题的答案。 这是因为云上的解析SDK版本太低,所以我必须将其更新到最新版本,它现在可以工作了。 非常感谢