I have a Parse-Server (hosted by heroku) that I have configured to send push notifications. It appears set up correctly on the dashboard, but when I got to actually send one it just says the push is "Saved" but when I go to check its status, it has failed to send. Here is the index.js for the set up:
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 || "{}"),
});
The PARSE_SERVER_PUSH
(as well as the appId, masterKey and serverURL) is configured on my config vars on the heroku site as follows:
{ "ios":
{ "pfx": "/Users/path/to/folder/Prod\Cert.p12 ",
"passphrase": "******",
"bundleId": "com.parse.app",
"production": true
}
}
I am not sure why the dashboard appears to have the server set up to correctly send the push notifications, but they all fail?
Edit: I also tried to send the push via 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
This returned {"result":true} on my terminal, and yet it still showed that the push failed on the dashboard.
Edit2: I have also noticed that despite selecting a specific audience that I created for the pushes, the parse-server always reports that I attempted to send it to the default "Everyone". Not sure if that provides any additional hints or not.