ERR!解析服务器推送适配器APNS找不到vaild连接
问题描述:
每当我使用下面的代码云派解析服务器上的推送通知2.2.24ERR!解析服务器推送适配器APNS找不到vaild连接
Parse.Push.send({
where: query,
data: {
alert: "You have a new comment on " + rift.get("title")
}
}, { useMasterKey: true }).then(() => {
console.log('Push ok');
}, (e) => {
console.log('Push error', e);
});
我碰到下面的日志与详细=设置1 Heroku的。
2016-11-06T05:08:06.783331+00:00 app[web.1]: verbose: RESPONSE from [POST] /api/1/push: {
2016-11-06T05:08:06.783333+00:00 app[web.1]: "headers": {
2016-11-06T05:08:06.783334+00:00 app[web.1]: "X-Parse-Push-Status-Id": "NbZCxyCOgc"
2016-11-06T05:08:06.783334+00:00 app[web.1]: },
2016-11-06T05:08:06.783335+00:00 app[web.1]: "response": {
2016-11-06T05:08:06.783336+00:00 app[web.1]: "result": true
2016-11-06T05:08:06.783336+00:00 app[web.1]: }
2016-11-06T05:08:06.783337+00:00 app[web.1]: } X-Parse-Push-Status-Id=NbZCxyCOgc, result=true
2016-11-06T05:08:06.787076+00:00 app[web.1]: Push ok
2016-11-06T05:08:06.788233+00:00 app[web.1]: verbose: sending push to 1 installations
2016-11-06T05:08:06.789569+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Notification transmitted to 443d4d770217648350c5c7cd7bb22d2da77223e23c06f3eb016b2e2ca76d6202
2016-11-06T05:08:06.790600+00:00 app[web.1]: verbose: sent push! 1 success, 0 failures
2016-11-06T05:08:06.867209+00:00 app[web.1]: ERR! parse-server-push-adapter APNS cannot find vaild connection for 443d4d770217648350c5c7cd7bb22d2da77223e23c06f3eb016b2e2ca76d6202
2016-11-06T05:08:06.868965+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2016-11-06T05:08:06.928135+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Connected
所以它说它已成功发送(我们收到NO通知到设备),我们得到一个ERR! parse-server ....分配给苹果公司TestFlight应用程序的应用程序中的有效设备注册的每个设备令牌。我已经阅读了多个关于如何解决这个问题的帖子,并尝试了一切,但没有成功。如果任何人有任何洞察,为什么这可能发生请让我知道!我将不胜感激
我们的index.js有以下配置设置...我们检查了生产证书,甚至拒绝了我们所有的证书并生成了新的证书。
push: {
ios: {
pfx: 'cert-prod.p12',
bundleId: 'a.bundle.id'
}
}
答
我最近有过这个问题。你确定pfx文件的路径是完整路径吗?我使用的路径模块来解决这个问题:
var path = require('path');
opts.push.ios = {
// The filename of private key and certificate in PFX
pfx: path.join(__dirname, env.IOS_PUSH_PFX),
bundleId: env.IOS_BUNDLE_ID
}
借鉴https://github.com/ParsePlatform/parse-server/issues/3025#issuecomment-258957541