发送推送通知的困难(Parse-Server / Heroku) [英] Difficulties sending push-notifications (Parse-Server/Heroku)

查看:138
本文介绍了发送推送通知的困难(Parse-Server / Heroku)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从我的(客观的C,iOS)应用程序发送推送通知。



由于这是我第一次在环境我可能错过了一些重要的细节。



下面是我在index.js中用于ParseServer初始化的代码的形状:

  var api = new ParseServer({
databaseURI:databaseUri ||'mongodb:// heroku_xyz336:..... mlab.com:... / heroku_xyz336',
cloud:process.env.CLOUD_CODE_MAIN || __dirname +'/cloud/main.js',
appId:process.env.APP_ID ||'myAppID',
masterKey: process.env.MASTER_KEY ||'myMasterKey',
push:{
ios:[
{
pfx:'/cloud/MY_APP.Dev.p12',
bundleId:'me.you.bundleId',
production:false // Dev
},
{
pfx:'/cloud/MY_APP.Prod.p12',
bundleId:'me.you.bundleId',
producti on:true // Prod
}
]
},
fileKey:process.env.FILE_KEY || 'myFileKey',
serverURL:process.env.SERVER_URL || 'https://myApp.herokuapp.com/parse',
liveQuery:{
classNames:[ClassOne,ClassTwo,ClassThree] //支持查询订阅的类列表
}
});

以下是我在日志中获得的内容:

  app [web.1]:现在在功能推送通知中。 
app [web.1]:info:beforeSave触发了MyApp的用户Yacb7KxgA9:
app [web.1]:输入:{....}
app [web.1 ]:结果:{object:{....}} className = MyApp,triggerType = beforeSave,user = Yacb7KxgA9
heroku [router]:at = info method = POST path =/ parse / classes / Config / CIImaTgfD8Shost = vi-da-sta.herokuapp.com request_id = ... fwd =12.211.213.333dyno = web.1 connect = 0ms service = 201ms status = 200 bytes = 522
app [web.1]:/app/node_modules/parse-server/lib/ParseServer.js:425
app [web.1]:throw err;
app [web.1]:^
app [web.1]:
app [web.1]:Error:ENOENT:no such file or directory,open'/ cloud / MyApp .Prod.p12'
app [web.1]:at Error(native)
app [web.1]:
app [web.1]:npm ERR! Linux 3.13.0-100-generic
app [web.1]:npm ERR! argv/app/.heroku/node/bin/node/app/.heroku/node/bin/npmstart
app [web.1]:npm ERR! node v6.9.1
app [web.1]:npm ERR! npm v3.10.8
app [web.1]:npm ERR!代码ELIFECYCLE
app [web.1]:npm ERR! parse-server-example@1.4.0 start:`node index.js`
app [web.1]:npm ERR!退出状态7
app [web.1]:npm ERR!
app [web.1]:npm ERR!在parse-server-example@1.4.0启动脚本'node index.js'失败。
app [web.1]:npm ERR!确保安装了最新版本的node.js和npm。
app [web.1]:npm ERR!如果这样做,这很可能是parse-server-example包
app [web.1]的一个问题:npm ERR!而不是npm本身。
app [web.1]:npm ERR!告诉作者,这在你的系统上失败:
app [web.1]:npm ERR! node index.js
app [web.1]:npm ERR!您可以通过以下链接获取有关如何为此项目打开问题的信息:
app [web.1]:npm ERR! npm bugs parse-server-example
app [web.1]:npm ERR!或者,如果没有,您可以通过以下方式获取他们的信息:
app [web.1]:npm ERR! npm owner ls parse-server-example
app [web.1]:npm ERR!上面可能还有其他日志记录输出。
app [web.1]:
app [web.1]:npm ERR!请在任何支持请求中包含以下文件:
app [web.1]:npm ERR! /app/npm-debug.log
heroku [web.1]:状态从up更改为崩溃
heroku [web.1]:进程退出状态1
heroku [router]: at = error code = H10 desc =App crashedmethod = POST path =/ parse / logout...... dyno = web.1 connect = 0ms service = status = 503 bytes =
heroku [ web.1]:状态从崩溃改为开始
heroku [web.1]:用命令`npm start`启动进程
app [web.1]:
app [web.1 ]:> parse-server-example@1.4.0 start / app
app [web.1]:> node index.js
app [web.1]:
app [web.1]:在端口19647上运行的parse-server-example。
app [web.1]:info:Parse LiveQuery Server开始运行
heroku [web.1]:状态从开始更改为

尽管上面的日志很模糊,但我可以注意到这样的部分:

 错误:ENOENT:没有这样的文件或目录,打开'/cloud/MyApp.Prod.p12'

但我确定MyApp.Prod.p12在云文件夹下本地存在。
An by running:

  heroku run bash 

我也可以检查它是否在服务器上。



难道是因为我已经放过了。 p12文件在错误的地方?或者别的什么?

p12',

使用pfx:'cloud / MY_APP.Dev.p12',


I am having trouble sending push-notifications from an (objective C, iOS) app of mine.

Since it is the first time I am doing this in this environment I am probably missing some important detail.

Here is the shape of my code for the ParseServer initialization inside index.js:

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://heroku_xyz336:.....mlab.com:.../heroku_xyz336',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppID',
  masterKey: process.env.MASTER_KEY || 'myMasterKey',
  push: {
      ios: [
        {
          pfx: '/cloud/MY_APP.Dev.p12',
          bundleId: 'me.you.bundleId',
          production: false // Dev
        },
        {
          pfx: '/cloud/MY_APP.Prod.p12',
          bundleId: 'me.you.bundleId',  
          production: true // Prod
        }
      ]
  },
  fileKey: process.env.FILE_KEY || 'myFileKey',
  serverURL: process.env.SERVER_URL || 'https://myApp.herokuapp.com/parse',
  liveQuery: {
    classNames: ["ClassOne", "ClassTwo", "ClassThree"] // List of classes to support for query subscriptions
  }
});

Here is what I get in the logs:

app[web.1]: Now inside function pushing Notifications.
 app[web.1]: info: beforeSave triggered for MyApp for user Yacb7KxgA9:
 app[web.1]:   Input: {"....}
 app[web.1]:   Result: {"object":{"....}} className=MyApp, triggerType=beforeSave, user=Yacb7KxgA9
 heroku[router]: at=info method=POST path="/parse/classes/Config/CIImaTgfD8S" host=vi-da-sta.herokuapp.com request_id=... fwd="12.211.213.333" dyno=web.1 connect=0ms service=201ms status=200 bytes=522
 app[web.1]: /app/node_modules/parse-server/lib/ParseServer.js:425
 app[web.1]:             throw err;
 app[web.1]:             ^
 app[web.1]: 
 app[web.1]: Error: ENOENT: no such file or directory, open '/cloud/MyApp.Prod.p12'
 app[web.1]:     at Error (native)
 app[web.1]: 
 app[web.1]: npm ERR! Linux 3.13.0-100-generic
 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
 app[web.1]: npm ERR! node v6.9.1
 app[web.1]: npm ERR! npm  v3.10.8
 app[web.1]: npm ERR! code ELIFECYCLE
 app[web.1]: npm ERR! parse-server-example@1.4.0 start: `node index.js`
 app[web.1]: npm ERR! Exit status 7
 app[web.1]: npm ERR! 
 app[web.1]: npm ERR! Failed at the parse-server-example@1.4.0 start script 'node index.js'.
 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
 app[web.1]: npm ERR! If you do, this is most likely a problem with the parse-server-example package,
 app[web.1]: npm ERR! not with npm itself.
 app[web.1]: npm ERR! Tell the author that this fails on your system:
 app[web.1]: npm ERR!     node index.js
 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
 app[web.1]: npm ERR!     npm bugs parse-server-example
 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
 app[web.1]: npm ERR!     npm owner ls parse-server-example
 app[web.1]: npm ERR! There is likely additional logging output above.
 app[web.1]: 
 app[web.1]: npm ERR! Please include the following file with any support request:
 app[web.1]: npm ERR!     /app/npm-debug.log
 heroku[web.1]: State changed from up to crashed
 heroku[web.1]: Process exited with status 1
 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/parse/logout" ...... dyno=web.1 connect=0ms service= status=503 bytes=
 heroku[web.1]: State changed from crashed to starting
 heroku[web.1]: Starting process with command `npm start`
 app[web.1]: 
 app[web.1]: > parse-server-example@1.4.0 start /app
 app[web.1]: > node index.js
 app[web.1]: 
 app[web.1]: parse-server-example running on port 19647.
 app[web.1]: info: Parse LiveQuery Server starts running
 heroku[web.1]: State changed from starting to up

Even though the log above is pretty obscure, I can notice the part that says:

Error: ENOENT: no such file or directory, open '/cloud/MyApp.Prod.p12'

But I am sure MyApp.Prod.p12 exists locally under the cloud folder. An by running:

heroku run bash

I can also checked that it actually is on the server.

Could it be that I have put the .p12 file at the wrong place? Or something else?

解决方案

Instead of pfx: '/cloud/MY_APP.Dev.p12',  

Use pfx: 'cloud/MY_APP.Dev.p12',

这篇关于发送推送通知的困难(Parse-Server / Heroku)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆