Getting this error "ERR! parse-server-push-adapter APNS cannot find vaild connection", while sending message from one application to another application.
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);
Getting this error "ERR! parse-server-push-adapter APNS cannot find vaild connection", while sending message from one application to another application.
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);