From Cloud Code, how can I request settings appropriate for a set of users?

I am using a standalone Parse server trying to send a push notification to multiple installations.

Parse Server does not allow me to request the installation build from the cloud code, returning the following error:

Error handling request: ParseError { code: 119, message: 'Clients aren\'t allowed to perform the find operation on the installation collection.' } code=119, message=Clients aren't allowed to perform the find operation on the installation collection. 

The request in Cloud Code is as follows:

 var pushQuery = new Parse.Query(Parse.Installation); pushQuery.containedIn('user', users); pushQuery.find({ ... 

What is the correct way to get a list of settings for a set of users and send all clicks to them?

I also tried using Cloud Code to use masterKey by calling Parse.Cloud.useMasterKey(); immediately before the request. No effect and master key are included in the request headers of the request.

+6
source share
1 answer

This is due to the fact that Parse.Cloud.useMasterKey() deprecated after the Parse server version 2.3.0. Now you need to use useMasterKey: true in your request.

For instance:

 var pushQuery = new Parse.Query(Parse.Installation); pushQuery.containedIn('user', users); pushQuery.find({useMasterKey: true }).then(function(results) { 
+4
source

Source: https://habr.com/ru/post/1014000/


All Articles