简体   繁体   English

解析服务器云代码错误141:未经授权

[英]Parse Server Cloud Code Error 141: Unauthorized

I have just created a parse-server deployment for learning on Cloud9 and everything works fine when I am accessing it using the REST API using PostMan. 我刚刚创建了一个用于在Cloud9上学习的解析服务器部署,当我使用PostMan使用REST API访问它时,一切正常。 I am now trying out Cloud Functions. 我现在正在尝试云功能。

I have the following code in my cloud.js file, 我的cloud.js文件中有以下代码,

Parse.Cloud.define('hello', function(request, response) {
    var query = new Parse.Query("Test");
      query.find({
          success: function(data){
              response.success(query);
          },
          error: function(err){
              response.error(err);
          }
      })
});

And in the response I get the following error, 在响应中我得到以下错误,

{
  "code": 141,
  "error": {
    "message": "unauthorized"
  }
}

My request on PostMan looks something like this, 我在PostMan上的请求看起来像这样,

带标题和URL的邮递员请求

The response is fine as long as I do not try a query and send a simple response like response.success("OK") . 只要我不尝试查询并发送像response.success("OK")这样的简单response.success("OK")

Is this an issue with Parse or am I missing something related to authorization? 这是Parse的问题还是我遗漏了与授权相关的内容?

我所要做的就是在find方法中添加useMasterKey: true

query.find({ useMasterKey: true, success: function(data){ response.success(query); }, error: function(err){ response.error(err); } })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM