I have the next problem, when I intend to send a push notification with parse server response:
It is when I insert:
My code of configuration is:
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer
(
{
databaseURI: 'mongodb://localhost:27017/myapp',
appId: 'tc',
masterKey: 'master',
clientKey: 'token',
serverURL: 'http://localhost:1337/parse',
push:
{
android:
{
senderId: '1066279412344',
apiKey: 'AIzaSyD2ysuFbFnNJNBwvILdemlxwf55q7yIHgI'
}
}
}
);
// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);
// Hello world
app.get('/', function(req, res) {
res.status(200).send('Express is running here.');
});
var port = process.env.PORT || 1337;
app.listen(port, function() {
console.log('Parse Server running on port ' + port + '.');
});
I have the same problem and i have tried these steps
1) Change APIKEY
2) Open PORTS in firewall 5228,5229,5230
The pushes are being sent to iOS phones normal.
Make sure the API key is a server API key and wait 5 minutes from creating it to testing.
I'm having the same problem with parse-server in aws.
The ports 522, 5229, 5230 are open, but im still getting error.
Im using the sample post, just with the difference of installationId of my APP:
curl -X POST \
-H "X-Parse-Application-Id: PARSE_APP_ID" \
-H "X-Parse-Master-Key: PARSE_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{
"where": {
"installationId": "89cbbbe8-7115-4eb6-902b-c5e9fbb07cb5",
"deviceType": {
"$in": [
"android"
]
}
},
"data": {
"title": "The Shining",
"alert": "All work and no play makes Jack a dull boy."
}
}' \
http://PARSE_SERVER_URL/push
And the verbose response is:
`
verbose: POST /push { host: 'PARSE_SERVER_URL',
'user-agent': 'curl/7.47.0',
accept: '_/_',
'x-parse-application-id': PARSE_APP_ID,
'x-parse-master-key': PARSE_MASTER_KEY,
'content-type': 'application/json',
'content-length': '322' } {
"where": {
"installationId": "89cbbbe8-7115-4eb6-902b-c5e9fbb07cb5",
"deviceType": {
"$in": [
"ios",
"android"
]
}
},
"data": {
"title": "The Shining",
"alert": "All work and no play makes Jack a dull boy."
}
}
verbose: {
"headers": {
"X-Parse-Push-Status-Id": "nkTAXFhoEs"
},
"response": {
"result": true
}
}
verbose: sending push to 1 installations
verb parse-server-push-adapter GCM sending to 1 device
ERR! parse-server-push-adapter GCM send errored: {}
verbose: sent push! 0 success, 1 failures
`
The errored getting empty
This issue is related to the parse-server-push-adapter, please open on the relevant repository.
@Silkjaer You are a savior!!! I had been working on this for hours and couldn't figure out the problem! It was confusing that it was asking for an apikey and gcm gives you the option to make an Android apikey. I now realize that is used for upstream notifications!
Most helpful comment
Make sure the API key is a server API key and wait 5 minutes from creating it to testing.