parse-community / parse-server-push-adapter

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

Push not sent to iOS Device #4

Closed okaris closed 8 years ago

okaris commented 8 years ago

For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Heroku (Performace 1x) + mLab (Dedicated Cluster M3) running parse-server-example with parse-server 2.2.2

Steps to reproduce

`var api = new ParseServer({ databaseURI: databaseUri || '...', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || '...', masterKey: process.env.MASTER_KEY || '...', //Add your master key here. Keep it secret! fileKey: ...', //This is needed to display old files on Parse's S3 serverURL: process.env.SERVER_URL || 'http://localhost:1337', // Set to correct url from heroku env filesAdapter: new S3Adapter( "...", "...", "...", {directAccess: true, region:"s3-eu-west-1.amazonaws.com"} ), push: { ios: [ { pfx: dirname + '/development.p12', // Prod PFX or P12 bundleId: 'com.okaris.myapp',
production: false // Prod }, { pfx:
dirname + '/production.p12', // Prod PFX or P12 bundleId: 'com.okaris.myapp',
production: true // Prod } ] }

});`

Logs/Trace

2016-03-21T20:56:16.089931+00:00 app[web.1]: POST /parse/push { host: 'coralline.herokuapp.com', 2016-03-21T20:56:16.089940+00:00 app[web.1]: connection: 'close', 2016-03-21T20:56:16.089941+00:00 app[web.1]: 'user-agent': 'node-XMLHttpRequest, Parse/js1.8.1 (NodeJS 5.8.0)', 2016-03-21T20:56:16.089942+00:00 app[web.1]: accept: '*/*', 2016-03-21T20:56:16.089943+00:00 app[web.1]: 'content-type': 'text/plain', 2016-03-21T20:56:16.089951+00:00 app[web.1]: 'x-request-id': '9efc6deb-5c34-4e21-9dc1-8c7594f14090', 2016-03-21T20:56:16.089952+00:00 app[web.1]: 'x-forwarded-for': '54.74.165.67', 2016-03-21T20:56:16.089953+00:00 app[web.1]: 'x-forwarded-proto': 'https', 2016-03-21T20:56:16.089953+00:00 app[web.1]: 'x-forwarded-port': '443', 2016-03-21T20:56:16.089954+00:00 app[web.1]: via: '1.1 vegur', 2016-03-21T20:56:16.089954+00:00 app[web.1]: 'connect-time': '0', 2016-03-21T20:56:16.089955+00:00 app[web.1]: 'x-request-start': '1458593776087', 2016-03-21T20:56:16.089956+00:00 app[web.1]: 'total-route-time': '0', 2016-03-21T20:56:16.089956+00:00 app[web.1]: 'content-length': '399' } { 2016-03-21T20:56:16.089957+00:00 app[web.1]: "where": { 2016-03-21T20:56:16.089958+00:00 app[web.1]: "user": { 2016-03-21T20:56:16.089958+00:00 app[web.1]: "__type": "Pointer", 2016-03-21T20:56:16.089959+00:00 app[web.1]: "className": "_User", 2016-03-21T20:56:16.089960+00:00 app[web.1]: "objectId": "BUCrtfWPdz" 2016-03-21T20:56:16.089960+00:00 app[web.1]: } 2016-03-21T20:56:16.089961+00:00 app[web.1]: }, 2016-03-21T20:56:16.089962+00:00 app[web.1]: "data": { 2016-03-21T20:56:16.089962+00:00 app[web.1]: "alert": { 2016-03-21T20:56:16.089963+00:00 app[web.1]: "loc-key": "LikeNotification", 2016-03-21T20:56:16.089963+00:00 app[web.1]: "loc-args": [ 2016-03-21T20:56:16.089964+00:00 app[web.1]: "okaris", 2016-03-21T20:56:16.089965+00:00 app[web.1]: "O" 2016-03-21T20:56:16.089965+00:00 app[web.1]: ] 2016-03-21T20:56:16.089966+00:00 app[web.1]: }, 2016-03-21T20:56:16.089967+00:00 app[web.1]: "badge": "Increment", 2016-03-21T20:56:16.089967+00:00 app[web.1]: "sound": "PopDing.caf" 2016-03-21T20:56:16.089968+00:00 app[web.1]: } 2016-03-21T20:56:16.089969+00:00 app[web.1]: } 2016-03-21T20:56:16.092150+00:00 app[web.1]: response: { 2016-03-21T20:56:16.092160+00:00 app[web.1]: "response": { 2016-03-21T20:56:16.092161+00:00 app[web.1]: "result": true 2016-03-21T20:56:16.092162+00:00 app[web.1]: } 2016-03-21T20:56:16.092163+00:00 app[web.1]: } 2016-03-21T20:56:16.095961+00:00 app[web.1]: ##### PUSH OK

Server logs "PUSH OK" but I don't see any APNS Connection logs, no push is delivered. Tried with both production and development certificates. Certificates don't have passwords. Tried using empty android push config and not. Tried using CURL with same result.

Cloud Code:

var pushQuery = new Parse.Query(Parse.Installation, { useMasterKey: true }); pushQuery.equalTo('user', user); Parse.Push.send({ where: pushQuery, data: { alert: { "loc-key": "LikeNotificationNoContent", "loc-args": [sender.get('screenName')] }, badge: "Increment", sound: "PopDing.caf" } }, { success: function() { console.log('##### PUSH OK'); }, error: function(error) { console.log('##### PUSH ERROR' + error); }, useMasterKey: true });

firaskafri commented 8 years ago

Can you post your _PushStatus contents from your DB records?

okaris commented 8 years ago

@firasalkafri I had the same issue on Parse-Server repo. It is closed but it isn't fixed for me. https://github.com/ParsePlatform/parse-server/issues/1127

firaskafri commented 8 years ago

@okaris I know, I'm having the same problem with GCM

firaskafri commented 8 years ago

@okaris I can confirm the GCM adapter is working now, can you clone parse-server and use it in your project instead of the one you installed through npm?

okaris commented 8 years ago

@firasalkafri I tried pointing parse-server git as a dependency but when I do my build fails, node can't find parse-server module - even though i can see it in node_modules

flovilmart commented 8 years ago

@okaris yes it can't because the lib folder is not under version control.

firaskafri commented 8 years ago

My testing environment is currently messed up but can you try linking the cloned repo to your project and then install from source?

okaris commented 8 years ago

@flovilmart Is there a way I can use the latest repo from github in my project? I tried using the parse-server-push-adapter as you told. I have initiated the adapter and passed the adapter for the push: parameter to the Parse-Server. But it throws an iterator error from ParsePushAdapter.js

yaalaa commented 8 years ago

Hi folks, It's definitely not delivering notifications. Here's what I see in the log:

verb parse-server-push-adapter APNS APNS Connection 0 Connected
verb parse-server-push-adapter APNS APNS Connection 0 Notification transmitted to <mydevicetoken>
ERR! parse-server-push-adapter APNS cannot find vaild connection for <mydevicetoken>
verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
verb parse-server-push-adapter APNS APNS Connection 0 Connected
okaris commented 8 years ago

ERR! parse-server-push-adapter APNS no qualified connections for

flovilmart commented 8 years ago

Thierry occurs when no valid configuration is available to send your push. Check your certificates, configuration as well as bundleId

yaalaa commented 8 years ago

@flovilmart is it for me or @okaris ?:)

okaris commented 8 years ago

@flovilmart bundleId and p12 files are the same ones I use on Hosted Parse. I've also tested that their path is correct and the files exist on the server.

okaris commented 8 years ago

@flovilmart solved it. I have rechecked and rechecked everything from scratch. i made a typo in the bundleId. one letter was lowercase instead of uppercase. sorry for the trouble. keep up the goodwork. Thanks especially for the parse-image wrapper. saved me a ton of time!

issue can be closed

yaalaa commented 8 years ago

folks, please take a look at my log. it looks not so good :(

flovilmart commented 8 years ago

@yaalaa the @okaris issue is solved. Please check your parameters as well. This is clearly not an issue as many users manage to make it work correctly.

okaris commented 8 years ago

@yaalaa make sure your certificates are not password protected. follow the push guide on parse-server. and make sure your bundleId is exactly as you use in developer member center at apple.

yaalaa commented 8 years ago

I duped parse app which had push working good. So all parameters look good.

flovilmart commented 8 years ago

guys, take it to stack overflow as this is clearly not an error from this module.

verb parse-server-push-adapter APNS APNS Connection 0 Connected
verb parse-server-push-adapter APNS APNS Connection 0 Notification transmitted to <mydevicetoken>
ERR! parse-server-push-adapter APNS cannot find vaild connection for <mydevicetoken>
verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
verb parse-server-push-adapter APNS APNS Connection 0 Connected
``` 

That means that your configuration is incorrect for your devices, like using a prod certificate for a dev device token and the opposite. The certificate can manage to connect but APN rejects your request.