parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
87 stars 99 forks source link

ERR! parse-server-push-adapter APNS cannot find vaild connection #21

Closed funkenstrahlen closed 6 months ago

funkenstrahlen commented 8 years ago

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

    push: {
        android: { senderId: '...', apiKey: '...' }, // setting android keys empty to remove error
        ios: {
          pfx: __dirname + process.env.APN_PUSH_P12_PATH, // The filename of private key and certificate in PFX or PKCS12 format from disk  
          bundleId: process.env.APN_BUNDLE_ID, // The bundle identifier associate with your app
          production: false // Specifies which environment to connect to: Production
        }
    }

Steps to reproduce

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

Apr 19 20:36:36 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 19 20:36:36 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 19 20:36:37 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 19 21:42:54 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 19 21:42:55 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 19 21:42:55 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 20 19:29:50 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 20 19:29:51 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 20 19:29:52 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 20 23:56:00 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 20 23:56:01 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 20 23:56:02 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 21 20:30:10 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 21 20:30:11 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 21 20:30:12 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 21 22:30:59 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 21 22:31:00 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 21 22:31:01 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 22 16:17:58 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 22 16:17:58 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 22 16:17:59 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 22 16:33:06 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 22 16:33:07 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 22 16:33:07 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 22 16:34:49 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 22 16:34:50 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 22 16:34:51 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 22 17:10:04 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 22 17:10:04 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 22 17:10:05 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 24 10:47:19 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 24 10:47:19 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 24 10:47:20 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 24 11:02:55 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 24 11:02:56 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 24 11:02:57 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 24 11:25:33 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 24 11:25:34 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 24 11:25:34 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
Apr 24 11:38:18 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 03750761765ab097c58b1f90d30a078d892
Apr 24 11:38:18 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 37bc6500dd5e33ff43dc7a3f1e45ebc25a5
Apr 24 11:38:19 xsn-app parse-app-production[6721]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 899efce347b266412d39da18379569bdaa7
mbxt commented 8 years 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.

funkenstrahlen commented 8 years ago

Does your server actually stay alive across these errors?

Yes it does. It also sends out the push messages correctly.

mbxt commented 8 years ago

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.

jatinp-sufalamtech commented 7 years ago

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);

mtrezza commented 6 months ago

Closing as outdated