Closed funkenstrahlen closed 6 months ago
Does your server actually stay alive across these errors? I'm experiencing the same error (though because we switched APN certificates), but it results in a fatal crash and the server must be restarted. I'm wondering if I'm missing some sort of necessary recovery option or module.
Does your server actually stay alive across these errors?
Yes it does. It also sends out the push messages correctly.
Thanks for the response, @funkenstrahlen . Looks like something was wrong with the certs I was using, but now that I have the correct key, the server stays alive. I too have a deviceToken that is invalid and causing the same error you report, but thankfully it's no longer a fatal error.
I am getting the same error and my server is alive, actually I am able to send push notification from first application to second application but unable to send from second application to first application, by the way I have installed two application in same device.
Following is my index.js file of parse server,
// Example express application adding the parse-server module to expose Parse // compatible API routes.
const resolve = require('path').resolve;
var express = require('express'); var ParseServer = require('parse-server').ParseServer; var path = require('path'); var SimpleMailgunAdapter = require('/var/WWW/Parse/node_modules/parse-server-simple-mailgun-adapter'); var FpPushAdapter = require('/var/WWW/Parse/node_modules/parse-server-fp-push-adapter'); var path = require('path'); var pushConfig = { ios: [ //like official parse-server-push-plugin (already array compatible), e.g.: { pfx: '/var/WWW/Parse/files/nct_apns-dev-cert.p12', // Prod PFX or P12 // pfx: path.join(dirname, "/files/Nector_apns-dev-cert.p12"), // passphrase: '', // optional password to your p12 bundleId: 'com.otl.nct', // cert: '/var/WWW/Parse/files/Nector_apns-dev.pem', // If not using the .p12 format, the path to the certificate PEM to load from disk production: true // Prod }, { pfx: '/var/WWW/Parse/files/nectorpro-apns-dev-cert.p12', // Dev PFX or P12 // pfx: path.join(dirname, "/files/nectorpro-apns-dev-cert.p12"), // passphrase: '', // optional password to your p12 bundleId: 'com.otl.nctpro', // cert: '/var/WWW/Parse/files/nctpro-apns-dev.pem', // If not using the .p12 format, the path to the certificate PEM to load from disk production: true // Dev } ] };
var fpPushAdapter = new FpPushAdapter(pushConfig);
var databaseUri = "";
if (!databaseUri) { console.log('DATABASE_URI not specified, falling back to localhost.'); }
var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || '/var/WWW/Parse/cloud/main.js', appId: process.env.APP_ID || '', masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret! serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed liveQuery: { classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions }, //Push Notification push: { adapter: fpPushAdapter } });
// Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: // javascriptKey, restAPIKey, dotNetKey, clientKey
var app = express();
// Serve static assets from the /public folder app.use('/public', express.static(path.join(__dirname, '/public')));
// Serve the Parse API on the /parse URL prefix var mountPath = process.env.PARSE_MOUNT || '/parse'; app.use(mountPath, api);
// Parse Server plays nicely with the rest of your web routes app.get('/', function(req, res) { res.status(200).send('I dream of being a website. Please star the parse-server repo on GitHub!'); });
// There will be a test page available on the /test path of your server url // Remove this before launching your app app.get('/test', function(req, res) { res.sendFile(path.join(__dirname, '/public/test.html')); });
var port = process.env.PORT || 1337; var httpServer = require('http').createServer(app);
httpServer.listen(port, function() { console.log('parse-server-example running on port ' + port + '.'); });
// This will enable the Live Query real-time server ParseServer.createLiveQueryServer(httpServer);
Closing as outdated
My parse server log is filled with
ERR! parse-server-push-adapter APNS cannot find vaild connection
errors. Push Notifications reach devices though. This seems to happen for devices that uninstalled the app and are now no longer reachable.Some discussion can be found here as this issue got moved and reopened here: https://github.com/ParsePlatform/parse-server/issues/1665#event-682204694
Environment Setup
Steps to reproduce
Expected Behaviour
Devices that are no longer reachable get removed from the database.
The make it clear: Push notification do get send out fine to valid devices. I just do not know why this error appears. I think the error is caused by devices which do not have the app installed any more?
Logs/Trace