1

I'm using Node.js to automate some of maintainance for my Parse app, and I'm having problems with requesting all of the User account data. I'm able to request the information when using the REST API but not when using the Javascript SDK.

Here is the code:

var Parse = require('parse').Parse;

Parse.initialize(PARSE_APP_ID, PARSE_JAVASCRIPT_KEY, PARSE_MASTER_KEY);

var query = new Parse.Query(Parse.User);

query.find({
  success: function (results) {
    console.log(results);
},
  error: function (error) {
    console.log(error);
  }
});

1 Answer 1

5

It wasn't clear from their documentation, but you have to use the Cloud SDK to even when you are not making requests from Cloud Code. If you look at their Javascript API Documentation, you can see this

"Available in Cloud Code and Node.js only."

To fix the issue, I had to add Parse.Cloud.useMasterKey(); to the above example. Here is the complete code.

var Parse = require('parse').Parse;

Parse.initialize(PARSE_APP_ID, PARSE_JAVASCRIPT_KEY, PARSE_MASTER_KEY);
Parse.Cloud.useMasterKey();

var query = new Parse.Query(Parse.User);

query.find({
  success: function (results) {
    console.log(results);
},
  error: function (error) {
    console.log(error);
  }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.