Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse Push Failing APNS With 0 Success 16 Failures #5181

Closed
2 tasks
antonfire opened this issue Nov 18, 2018 · 30 comments
Closed
2 tasks

Parse Push Failing APNS With 0 Success 16 Failures #5181

antonfire opened this issue Nov 18, 2018 · 30 comments

Comments

@antonfire
Copy link

Before opening the issue please ensure that you have:

Issue Description

Having upgraded initially from Parse Server 2.2.12 to Parse Server 2.8.4 then when this didn't work to Parse Server 3.1.1 push notifications are no longer working. The Verbose output is the following:

�[36mverbose�[39m: _PushStatus 7idQCLfPT6: sending push to installations with 1 batches
�[36mverbose�[39m: Sending push to 16
�[36mverbose�[39m: _PushStatus 7idQCLfPT6: sent push! 0 success, 16 failures
�[36mverbose�[39m: _PushStatus 7idQCLfPT6: needs cleanup devicesToRemove=[]

I have looked through all of the issues regarding push on both parse-server and parse-server-push-adaptor and have tried all offered solutions. Nothing has worked. I have tried taking the device token and sending via an APNS tester using my exact dev certificate used on parse and this successfully delivers every time. I initially tried PS 2.8.4 no luck then have tried 3.1.1 also the same error noted above. I'm using MongoDb on Mlab and AWS Elastic Beanstalk Running Node 8.11.4 and the following Package.json:

{
"name": "parse-server-example",
"version": "1.4.0",
"description": "An example Parse API server using the parse-server module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server-example"
},
"license": "MIT",
"dependencies": {
"cron": "1.1.0",
"express": "~4.11.x",
"firebase-admin": "^4.2.1",
"kerberos": "~0.0.x",
"parse": "~1.11.1",
"parse-server": "2.8.4",
"parse-server-accountkit-auth": "^1.0.0"
},
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0"
},
"scripts": {
"start": "node index.js"
},
"engines": {
"node": ">=8.11"
}
}

Has there been some upgrade with regard to _PushStatus which I need to know about between 2.2.12 and 2.8.4/3.1.1 with regards to _SCHEMA or is this not relevant to Mongo and just to Postgres? No entries in my _PushStatus table have a expiration_interval column.

Also I can't seem to get anymore verbose output with regard to the APNS error returned information than the above, is this right or do I need to run it locally to catch every bit if information to debug this?

Steps to reproduce

Send Push on Cloudcode to devices using usual and checked syntax that is stated to work by other posters.

Expected Results

Pushes to be sent and delivered.

Actual Outcome

Pushes are not received.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.8.4 and 3.1.1
    • Operating System: OSX on Cli AWS EB Linux
    • Hardware: AWS EB
    • Localhost or remote server? AWS EB
  • Database

    • MongoDB version: 3.0.12
    • Storage engine: MLAB
    • Hardware: MLAB/AWS EB
    • Localhost or remote server? Remote AWS Eb connecting to MLAB Mongo DB

Logs/Trace

�[36mverbose�[39m: _PushStatus 7idQCLfPT6: sending push to installations with 1 batches
�[36mverbose�[39m: Sending push to 16
�[36mverbose�[39m: _PushStatus 7idQCLfPT6: sent push! 0 success, 16 failures
�[36mverbose�[39m: _PushStatus 7idQCLfPT6: needs cleanup devicesToRemove=[]

This logging seems sparse, that's all I get with VERBOSE=1.

@flovilmart
Copy link
Contributor

How is your push adapter configured? It seems that the push doesn’t even reach APNS which makes me think of a mis configuration.

@antonfire
Copy link
Author

index is:

  ios: [
  {
    pfx: 'xxxredactedxxx.p12',
    topic: 'com.xxxredactedxxx.xxxredactedxxx',
    production: false
  },
  {
    pfx: 'SkoobaPushDistCert.p12',
    topic: 'com.xxxredactedxxx.xxxredactedxxx',
    production: true
  }]

main cloud code is:

		var query2 = new Parse.Query(Parse.Installation);
		query2.containedIn("userRoot", pushArray1);			
		// send pushes
		Parse.Push.send({
		  where: query2, 
		  data: {
			alert: "randomDailyPush",
			type: "daily push",
			sound:"default"
		  }
		}, 
		{
		  success: function(result) {
	  		console.log('pushes sent');
			response.success(result);
		  },
		  error: function(error) {
	  		console.log('pushes failed');
			response.error(error);
		  },
		  useMasterKey: true
		});		

@flovilmart
Copy link
Contributor

Can you try with a single certificate as it is now supported? Does the bundle ids/ topics match between the installation objects and the configuration?

@antonfire
Copy link
Author

Can I get some more verbose logs from the APNS service?

@antonfire
Copy link
Author

I looked at the single certificate option but couldn't see in Apple developer portal how to generate one

@flovilmart
Copy link
Contributor

You can set DEBUG=apn:* or DEBUG=apn to turn on the internal logging of the apn module

@antonfire
Copy link
Author

All certificates and provisioning profiles have remained the same during the development process and during release. The only thing I can think that has changed is that I changed the name of the of the app briefly duing development on the newest dev version only to see how it looked on the device built from Xcode, then changed back to what it was, this was purely a local dev change, nothing submitted or retained. I've tried getting a new cert and .p12 cert and no change, then tried the old certificate on the APNS tester which still works fine.

@antonfire
Copy link
Author

Ok can i do that as an environment setting in EB settings to get some more verbose output? Like VERBOSE = 1?

@flovilmart
Copy link
Contributor

Ok can i do that as an environment setting in EB settings to get some more verbose output

This is exactly how it should be used (as an environment variable).

Also, because you upgraded from an antique version of this project, it is possible many things changed.

@flovilmart
Copy link
Contributor

What version of node are you running?

@antonfire
Copy link
Author

Ok I'll try that and provide the more verbose logs so we can debug

@antonfire
Copy link
Author

8.11.4, I just added DEBUG=apn with no additional output just trying DEBUG=apn:*

@antonfire
Copy link
Author

Same response...

�[36mverbose�[39m: RESPONSE from [POST] /parse/push: {
"headers": {
"X-Parse-Push-Status-Id": "cuZlIiQsEM"
},
"response": {
"result": true
}
} X-Parse-Push-Status-Id=cuZlIiQsEM, result=true
zxzxzx pushes sent
{ result: true }
�[32minfo�[39m: Ran cloud function cron1MinutePushQueue for user undefined with:
Input: {"password":""}
Result: {"result":true} functionName=cron1MinutePushQueue, password=
, user=undefined
�[36mverbose�[39m: RESPONSE from [POST] /parse/functions/cron1MinutePushQueue: {
"response": {
"result": {
"result": true
}
}
} result=true
�[36mverbose�[39m: _PushStatus cuZlIiQsEM: sending push to installations with 1 batches
{ result: true }
�[36mverbose�[39m: Sending push to 16
�[36mverbose�[39m: _PushStatus cuZlIiQsEM: sent push! 0 success, 16 failures
�[36mverbose�[39m: _PushStatus cuZlIiQsEM: needs cleanup devicesToRemove=[]

@antonfire
Copy link
Author

Has there been a database update between versions that could cause this issue? Looking for data at the wrong object keys, indexes etc?

@flovilmart
Copy link
Contributor

I am tempted to say yes and no. You were running a version from June 2016, I cannot possibly remember all of the changes that were made between then and now. But the logs indicate the objects are properly pulled out of the DB as it mentions 16 installations. Actually is this what you expect?

Next thing would be to run the server locally, and send it locally connected to your prod Db or similar, and inject logs in the push adapter directly (located in node_modules/@parse/push-adapter)

@antonfire
Copy link
Author

Yes I have 16 instances of my login id in installations so that is correct, i.e. the query is returning the correct data. I can only imagine that there has been some database schema modification since my 2016 version that I stuck with and the latest or pre latest. I was under the impression though that mongo didn't require column definitions to make a database entry as you might expect with mySQL or simular, so I'm not sure I've got the problem pinpointed there.

@flovilmart
Copy link
Contributor

The modification you describe is unlikely, the _PushStatus did not change, and installation either. Can you provide an example installation object?

@antonfire
Copy link
Author

Yeah sure:

{
"_id": "DhlJu0aKuE",
"channels": [
"StandardUsers"
],
"deviceType": "ios",
"deviceToken": "2c6010c925df2f1dbc568608eca15ada7933ddba85d36c63372915c98b74xxxx",
"userRoot": "facebook:1015324900788xxxx-KYcnnp6Rm8gFW2GePzx",
"badge": 58,
"_created_at": {
"$date": "2016-12-10T12:57:29.412Z"
},
"_updated_at": {
"$date": "2018-08-18T11:15:17.838Z"
}
}

@antonfire
Copy link
Author

Am I not getting any APNS error output then do you think? I'm not even getting that far?

@flovilmart
Copy link
Contributor

That’s what I initially mentioned, your objects are sent to the adapter, but none are going further. I suspect it has to do with the missing bundle identifier in the installation object.

How did you create those installations? Through the iOS SDK?

@flovilmart
Copy link
Contributor

You are missing the appIdentifier value in your installation objects, which for latest version of the push adapter prevent sending the pushs. This value is set by the iOS SDK.

@antonfire
Copy link
Author

I'm using JS sdk to call Parse.Cloud.run in app (Cordova), that's it client side, all the code is run in Parse cloud as mentioned above. On login/Signup I use Parse.FacebookUtils.logIn( to pass the facebook and device details to the installation object

@flovilmart
Copy link
Contributor

Ok, but the installation object is created from a JS SDK, and therefore lacks the required app identifier that allows the push adapter to properly send push’s.

as I mentioned, this is done usually by the iOS SDK automatically, and you should do the same in your implementation of Installation in javascript

@antonfire
Copy link
Author

OK I'll have a look, does this mean all my previous users are now non pushable?

@flovilmart
Copy link
Contributor

You can always either:

  • set the appIdentifier in all existing objects
  • provide a change in the push adapter that would fallback when the app identifier is not provided

@antonfire
Copy link
Author

Could I fork parse server for a quick fix for me then submit a pull request to the main fork?

@flovilmart
Copy link
Contributor

The fix has to be made in the push adapter, not in the server. And you can provide any custom module as a push adapter so you technically can fix it on your own.

@antonfire
Copy link
Author

Main issue is though that I've done new installations on the new parse server which hasn't added appIdentifier to new installation objects. You'd expect this to be present right?

@antonfire
Copy link
Author

I thought 3.1.1 had the latest push adaptor integrated?

@flovilmart
Copy link
Contributor

Yes it has, the appIdentifier is set by the client alongside the deviceToken. You need to both fix your client side implementation and if you wish, implement a workaround in the push adapter.

None of this happen if you use the native iOS SDK.

Closing now as it’s not an issue with parse-server itself but with a client side custom implementation of Installations. (Or with the push adapter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants