parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.94k stars 4.78k forks source link

APNS cannot find vaild connection for #2838

Closed hugoerg56 closed 7 years ago

hugoerg56 commented 8 years ago

Testing the push notification adapter on heroku is working with Android, but on IOS get this (I supply a .p12 file):

2016-10-06T18:16:09.551015+00:00 heroku[router]: at=info method=POST path="/parse/push" host=parse-test-serene-e-44328.herokuapp.com request_id=84922a69-6b94-4c60-86d5-35ac79b71929 fwd="54.205.251.149" dyno=web.1 connect=1ms service=141ms status=200 bytes=533
2016-10-06T18:16:09.512733+00:00 heroku[router]: at=info method=POST path="/parse/push" host=parse-test-serene-e-44328.herokuapp.com request_id=986e2268-52ea-42b6-bfb9-abc1f92f0255 fwd="54.205.251.149" dyno=web.1 connect=1ms service=148ms status=200 bytes=533
2016-10-06T18:16:09.401023+00:00 app[web.1]: verbose: POST /parse/push { host: 'parse-test-.........herokuapp.com',
2016-10-06T18:16:09.401056+00:00 app[web.1]:   connection: 'close',
2016-10-06T18:16:09.401058+00:00 app[web.1]:   'user-agent': 'Parse for Ruby, 1.0.0.alpha1',
2016-10-06T18:16:09.401058+00:00 app[web.1]:   'content-type': 'application/json',
2016-10-06T18:16:09.401059+00:00 app[web.1]:   'x-parse-master-key': '.......',
2016-10-06T18:16:09.401060+00:00 app[web.1]:   'x-parse-application-id': '.....',
2016-10-06T18:16:09.401060+00:00 app[web.1]:   'x-parserubyclient-retries': '3',
2016-10-06T18:16:09.401061+00:00 app[web.1]:   'accept-encoding': 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
2016-10-06T18:16:09.401062+00:00 app[web.1]:   accept: '*/*',
2016-10-06T18:16:09.401062+00:00 app[web.1]:   'x-request-id': ....',
2016-10-06T18:16:09.401063+00:00 app[web.1]:   'x-forwarded-for': '54.205.251.149',
2016-10-06T18:16:09.401064+00:00 app[web.1]:   'x-forwarded-proto': 'http',
2016-10-06T18:16:09.401064+00:00 app[web.1]:   'x-forwarded-port': '80',
2016-10-06T18:16:09.401065+00:00 app[web.1]:   via: '1.1 vegur',
2016-10-06T18:16:09.401066+00:00 app[web.1]:   'connect-time': '1',
2016-10-06T18:16:09.401066+00:00 app[web.1]:   'x-request-start': '1475777769362',
2016-10-06T18:16:09.401067+00:00 app[web.1]:   'total-route-time': '0',
2016-10-06T18:16:09.401067+00:00 app[web.1]:   'content-length': '124' } {
2016-10-06T18:16:09.401068+00:00 app[web.1]:   "data": {
2016-10-06T18:16:09.401069+00:00 app[web.1]:     "alert": "You've Been Requested!",
2016-10-06T18:16:09.401069+00:00 app[web.1]:     "sound": "sosumi.aiff",
2016-10-06T18:16:09.401070+00:00 app[web.1]:     "message": "request",
2016-10-06T18:16:09.401070+00:00 app[web.1]:     "showing_id": 193
2016-10-06T18:16:09.401071+00:00 app[web.1]:   },
2016-10-06T18:16:09.401072+00:00 app[web.1]:   "where": {
2016-10-06T18:16:09.401072+00:00 app[web.1]:     "user_id": 7
2016-10-06T18:16:09.401073+00:00 app[web.1]:   }
2016-10-06T18:16:09.401074+00:00 app[web.1]: }
2016-10-06T18:16:09.413290+00:00 app[web.1]: verbose: POST /parse/push { host: 'parse-test-serene-e-44328.herokuapp.com',
2016-10-06T18:16:09.413292+00:00 app[web.1]:   connection: 'close',
2016-10-06T18:16:09.413293+00:00 app[web.1]:   'user-agent': 'Parse for Ruby, 1.0.0.alpha1',
2016-10-06T18:16:09.413294+00:00 app[web.1]:   'content-type': 'application/json',
2016-10-06T18:16:09.413294+00:00 app[web.1]:   'x-parse-master-key': '.....s',
2016-10-06T18:16:09.413295+00:00 app[web.1]:   'x-parse-application-id': '....',
2016-10-06T18:16:09.413295+00:00 app[web.1]:   'x-parserubyclient-retries': '3',
2016-10-06T18:16:09.413296+00:00 app[web.1]:   'accept-encoding': 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
2016-10-06T18:16:09.413296+00:00 app[web.1]:   accept: '*/*',
2016-10-06T18:16:09.413297+00:00 app[web.1]:   'x-request-id': ...',
2016-10-06T18:16:09.413297+00:00 app[web.1]:   'x-forwarded-for': '54.205.251.149',
2016-10-06T18:16:09.413297+00:00 app[web.1]:   'x-forwarded-proto': 'http',
2016-10-06T18:16:09.413298+00:00 app[web.1]:   'x-forwarded-port': '80',
2016-10-06T18:16:09.413301+00:00 app[web.1]:   via: '1.1 vegur',
2016-10-06T18:16:09.413301+00:00 app[web.1]:   'connect-time': '1',
2016-10-06T18:16:09.413301+00:00 app[web.1]:   'x-request-start': '1475777769407',
2016-10-06T18:16:09.413302+00:00 app[web.1]:   'total-route-time': '0',
2016-10-06T18:16:09.413302+00:00 app[web.1]:   'content-length': '124' } {
2016-10-06T18:16:09.413303+00:00 app[web.1]:   "data": {
2016-10-06T18:16:09.413303+00:00 app[web.1]:     "alert": "You've Been Requested!",
2016-10-06T18:16:09.413304+00:00 app[web.1]:     "sound": "sosumi.aiff",
2016-10-06T18:16:09.413304+00:00 app[web.1]:     "message": "request",
2016-10-06T18:16:09.413304+00:00 app[web.1]:     "showing_id": 193
2016-10-06T18:16:09.413305+00:00 app[web.1]:   },
2016-10-06T18:16:09.413305+00:00 app[web.1]:   "where": {
2016-10-06T18:16:09.413306+00:00 app[web.1]:     "user_id": 2
2016-10-06T18:16:09.413306+00:00 app[web.1]:   }
2016-10-06T18:16:09.413306+00:00 app[web.1]: }
2016-10-06T18:16:09.504812+00:00 app[web.1]: verbose: {
2016-10-06T18:16:09.504814+00:00 app[web.1]:   "headers": {
2016-10-06T18:16:09.504815+00:00 app[web.1]:     "X-Parse-Push-Status-Id": "...."
2016-10-06T18:16:09.504816+00:00 app[web.1]:   },
2016-10-06T18:16:09.504816+00:00 app[web.1]:   "response": {
2016-10-06T18:16:09.504817+00:00 app[web.1]:     "result": true
2016-10-06T18:16:09.504817+00:00 app[web.1]:   }
2016-10-06T18:16:09.504817+00:00 app[web.1]: }
2016-10-06T18:16:09.512858+00:00 app[web.1]: verbose: {
2016-10-06T18:16:09.512860+00:00 app[web.1]:   "headers": {
2016-10-06T18:16:09.512861+00:00 app[web.1]:     "X-Parse-Push-Status-Id": "....j"
2016-10-06T18:16:09.512862+00:00 app[web.1]:   },
2016-10-06T18:16:09.512862+00:00 app[web.1]:   "response": {
2016-10-06T18:16:09.512863+00:00 app[web.1]:     "result": true
2016-10-06T18:16:09.512864+00:00 app[web.1]:   }
2016-10-06T18:16:09.512864+00:00 app[web.1]: }
2016-10-06T18:16:09.603946+00:00 app[web.1]: verbose: sending push to 0 installations
2016-10-06T18:16:09.606542+00:00 app[web.1]: verbose: sent push! 0 success, 0 failures
2016-10-06T18:16:09.611347+00:00 app[web.1]: verbose: sending push to 2 installations
2016-10-06T18:16:09.620341+00:00 app[web.1]: verb parse-server-push-adapter GCM sending to 1 device
2016-10-06T18:16:09.632488+00:00 app[web.1]: ERR! parse-server-push-adapter APNS cannot find vaild connection for a9eefd34eff79f89516.............9c649fe8d07de49d49a1e
2016-10-06T18:16:09.634361+00:00 app[web.1]: /app/node_modules/parse-server/lib/ParseServer.js:407
2016-10-06T18:16:09.634362+00:00 app[web.1]:             throw err;
2016-10-06T18:16:09.634363+00:00 app[web.1]:             ^
2016-10-06T18:16:09.634363+00:00 app[web.1]: 
2016-10-06T18:16:09.634364+00:00 app[web.1]: Error: ENOENT: no such file or directory, open 'cert.pem'
2016-10-06T18:16:09.634366+00:00 app[web.1]:     at Error (native)
2016-10-06T18:16:09.650094+00:00 app[web.1]: 
2016-10-06T18:16:09.657408+00:00 app[web.1]: npm ERR! Linux 3.13.0-95-generic
2016-10-06T18:16:09.657886+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-10-06T18:16:09.658160+00:00 app[web.1]: npm ERR! node v5.11.1
2016-10-06T18:16:09.659005+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-10-06T18:16:09.659289+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-10-06T18:16:09.659538+00:00 app[web.1]: npm ERR! parse-server-example@1.4.0 start: `node index.js`
2016-10-06T18:16:09.659792+00:00 app[web.1]: npm ERR! Exit status 7
2016-10-06T18:16:09.659992+00:00 app[web.1]: npm ERR! 
2016-10-06T18:16:09.660191+00:00 app[web.1]: npm ERR! Failed at the parse-server-example@1.4.0 start script 'node index.js'.
2016-10-06T18:16:09.660494+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-10-06T18:16:09.660716+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the parse-server-example package,
2016-10-06T18:16:09.660933+00:00 app[web.1]: npm ERR! not with npm itself.
2016-10-06T18:16:09.661141+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-10-06T18:16:09.661539+00:00 app[web.1]: npm ERR!     node index.js
2016-10-06T18:16:09.661914+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-10-06T18:16:09.662117+00:00 app[web.1]: npm ERR!     npm bugs parse-server-example
2016-10-06T18:16:09.662331+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-10-06T18:16:09.662546+00:00 app[web.1]: npm ERR!     npm owner ls parse-server-example
2016-10-06T18:16:09.662765+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-10-06T18:16:09.666432+00:00 app[web.1]: 
2016-10-06T18:16:09.666639+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-10-06T18:16:09.666770+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-10-06T18:16:09.749921+00:00 heroku[web.1]: State changed from up to crashed
2016-10-06T18:16:09.750954+00:00 heroku[web.1]: State changed from crashed to starting
2016-10-06T18:16:09.726410+00:00 heroku[web.1]: Process exited with status 1
2016-10-06T18:16:13.728254+00:00 heroku[web.1]: Starting process with command `npm start`
2016-10-06T18:16:17.042451+00:00 app[web.1]: 
2016-10-06T18:16:17.042465+00:00 app[web.1]: > parse-server-example@1.4.0 start /app
2016-10-06T18:16:17.042466+00:00 app[web.1]: > node index.js
2016-10-06T18:16:17.042467+00:00 app[web.1]: 
2016-10-06T18:16:20.153169+00:00 app[web.1]: parse-server-example running on port 22825.
2016-10-06T18:16:20.695721+00:00 heroku[web.1]: State changed from starting to up

Any idea what is missing?

mignev commented 8 years ago

Can't find 'cert.pem'

Error: ENOENT: no such file or directory, open 'cert.pem'

mignev commented 8 years ago

Btw ... please be careful with sharing your master and other keys :)

hugoerg56 commented 8 years ago

thanks @mignev, so I need to include a cert.pem ?

hugoerg56 commented 8 years ago

I say that b/c on the documentation i see:

ios: {
    pfx: 'certs/mycert.p12', // the path and filename to the .p12 file you exported earlier. 
    cert: '', // If not using the .p12 format, the path to the certificate PEM to load from disk
    bundleId: '', // The bundle identifier associated with your app
    key: '', // If not using the .p12 format, the path to the private key PEM to load from disk
    production: true // Specifies which environment to connect to: Production (if true) or Sandbox
}

say that cert is If not using the .p12 format. but im using a p12 file

gateway commented 8 years ago

This could be a few things. Of course the first would be to check if you have the folder certs with the .p12 file in it and its actually on the server.

2nd which trips up a lot of people production certs (in apples dash board for your bundle indent you can create a dev apns cert and production one). The production only ONLY works when you have submitted your build to apple for release or thought test flight. It will fail and not send anything if your just building it with Xcode to your device.

When testing and building with Xcode to device make sure to use your dev apns .p12 key.

You might want to check this link, and if you have solved this already please mark this as closed.

https://support.urbanairship.com/hc/en-us/articles/213492383-How-to-check-your-APNS-push-certificate-environment-types

flovilmart commented 7 years ago

Closing as the push adapter was completely overhauled since, please reopen if the issue persists.