Analysis server cannot send push notifications?

I have a Parse-Server (hosted by heroku) that I configured to send push notifications. It displays correctly on the control panel, but when I actually send it, it just says that clicking "Saved", but when I go to check its status, it could not send. Here is the index.js index for customization:

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it $
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',  // Don't$
  liveQuery: {
    classNames: ["Posts", "Comments"] // List of classes to support for query s$
  },
  push: JSON.parse(process.env.SERVER_PUSH || "{}"),
});

PARSE_SERVER_PUSH (as well as appId, masterKey and serverURL) is configured in my configuration vars on heroku site as follows:

{ "ios": 
   { "pfx": "/Users/path/to/folder/Prod\Cert.p12 ", 
    "passphrase": "******", 
    "bundleId": "com.parse.app",
    "production": true
    }
}

I'm not sure why the dashboard has a server configured to send push notifications correctly, but all of them do not work?

Edit: I also tried sending push through an API request as follows:

curl -X POST \
    -H "X-Parse-Application-Id: myAppsID" \
    -H "X-Parse-Master-Key: ***************" \
    -H "Content-Type: application/json" \
    -d '{ 
        "where": { 
            "deviceType": { "$in": [ "ios",  "android"  ]  }  
        },
        "data": {
            "title": "Ant-man",
            "alert": "This is awesome. It is awesome."
        }
    }' \
    https://appName.herokuapp.com/parse/push

{ "result": true} , , .
Edit2: , , , , , "Everyone". , - .

+4
1

push parse-server, :

http://docs.parseplatform.org/parse-server/guide/#push-notifications

, , masterKey, . , , , push, masterKey

- NodeJS, JavaScript- , , . , : http://docs.parseplatform.org/js/guide/#push-notifications

, , .

:

Parse.Push.send({
    data: oPayload,
    where: oWhereQuery
}, {
        useMasterKey: true
    }).then(function () {
        console.log("Push notification sent to: " + aRecievers);
    }, function (err) {
        console.log("Failed to send push notification with error: " + err);
    });

, , , ​​( , APNS/GCM). - , , push-. , userMasterKey: true, , push

, , CURL, . ( : https://:/functions/

, .

+2

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


All Articles