-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Status 400 and reason BadDeviceToken #87
Comments
There is no particular way to ignore those, they are produced when running with VERBOSE
For now there isn't |
Hey @flovilmart, my VERBOSE setting is disabled, but my logs are filled with these errors by 90%. How do I turn them off? The fact that servers show and write these errors damage the performance. |
After looking into the repo, the error is reported by the logger as an error log, you won’t be able to disable it at that time. |
Hi @flovilmart, we are running our parse server with |
Looks like they just forgot to set the right setting for these errors. I've downgraded to an earlier version. |
Any news on this issue? Is there a way to switch the Push errors off? Or is there a way to automatically erase all Installations with Bad Device Tokens? |
As far as I know in the latest version there is a way to automatically delete bad tokens. |
Do you know any adequate way to find the bad device tokens and erase them? We have a bunch of them, and they only increase in numbers, especially the ones for Androids. They never self-delete even if the app is reinstalled. |
Hi @funkenstrahlen can you please tell the way to automatically delete bad tokens? thanks a lot. I have figured it out. After release 2.6.3, you can automatically delete bad tokens by setting the PARSE_SERVER_CLEANUP_INVALID_INSTALLATIONS environment variable = 1. Still thanks a lot to @funkenstrahlen for giving the hint. |
@wicked-wei , our tests for this PARSE_SERVER_CLEANUP_INVALID_INSTALLATIONS option showed that:
|
@halvini thanks for your comment. I haven't seen the problem you mentioned yet but I will keep eyes on it. |
@halvini can you please point out what part of the logic there is not working as expected? |
@flovilmart , the issue is described in this ticket: We are 100% sure that PARSE_SERVER_CLEANUP_INVALID_INSTALLATIONS flag cleans up even VALID ios installations. Why? I don't know. I've checked the StatusHandler, I've checked the APNS.js. I don't see anything unusual out there, but I believe that when you send many many push notifications to different installations, probably APNS returns BadDeviceToken error even for valid installations. It doesn't happen immediately. For instance, my own valid installation was unset by this flag in a week after I turned it on. So, probably, if there is a timeout, or any other connection or delivery error, the APNS thinks that device is either Unregistered, or Bad. |
@halvini you can also check that if there is an unexpected mixed using of both apple sandbox and production push on a same environment(or database). This may cause unexpected deletion of deviceToken. |
@wicked-wei the sandbox was used by 20 beta-testers only. When we set PARSE_SERVER_CLEANUP_INVALID_INSTALLATIONS flag, nothing bad happened at first, but then in 3 days we started getting complaints from both sandbox users and production users. Why were the production users affected by this flag? |
@halvini because sandbox and production use different deviceToken. If any chance you send a production deviceToken to a sandbox apns server, it will report that token is BadToken. Reverse is the same. |
@wicked-wei ok, so why did production users lose their deviceToken data, if we send push notifications from cloud code only? The parse-server config has both certificates installed:
|
@halvini the config looks ok, but I am not sure if parse server can tell a installation deviceToken is production or sandbox. For the js documents does not mention that, maybe it will send a token to both production or sandbox? I am not sure because I never do that. |
@wicked-wei , this is all quite informative, but it doesn't resolve the issue of undefined deviceTokens for valid ios installations. Your idea is to change the development certificate to a new bundle id, am I right? How can I be sure that that's the reason? I can't risk my production environment again. I've lost too much data when I set the PARSE_SERVER_CLEANUP_INVALID_INSTALLATIONS flag. It worked for a few days only but resulted in a huge mess. |
Did anyone find a solution to this issue? I'd like to set the PARSE_SERVER_CLEANUP_INVALID_INSTALLATIONS to 1 without losing valid iOS installations. |
Any update here? is |
im interested in this as well. just for the sake of keeping logs clean |
@alexblack @jeffreyjackson the only way to know if it's safe to use is for you guys to use it and report your findings. |
Well, there are some findings above, sounds risky, we'll find another way. |
That's not really helpful as the gate behind the feature flag is for the community to experiment. I'd rather revert the PR / feature if no one is willing to experiment with us. |
Fair point. I should share my other feedback - also not too excited about the feature in general, if device tokens are erased then it seems to make it harder to distinguish installations with no device token vs ones that were erased. This combined with the lack of real errors/transparency from parse push means we'll eventually just integrate with apple and google, then we'll have real errors back, and we can just mark installations as unreachable when we learn that from the source. Also as we've reported parse-dashboard doesn't display past pushes for us. So we're not really having a great experience here. |
This is what you were expecting originally, that this feature is working correctly, not sure where you're coming from with that.
I'm open for improving the project / provide a better feature but without community feedback this is unfortunately impossible. Opensource doesn't mean we the maintainers have to take all the risks and responsibility. The community pressed to have a cleanup invalid token implemented, IIRC you were part of it, I spent a shit load of hours on it, a tentative implementation has been available for a while and now you're pressing again today to have something else implemented. Do you understand how unfair, unethical and unwelcome those commentaries are? |
Sorry. Just sharing my feedback. :( |
Could we not discuss the requirements up front? If that new field (as I described it) is not what you'd like to see, then best to figure that out now I think. |
in all those discussions you would have had 10 times the time to implement this and run it, and see if it works for your use case. My gut feeling tells me that it will take you multiple iterations and days running in production to see if this works properly. |
For me, I think it'd make sense for us to have some tentative agreement on what the new field in (Also, we can't get started right away regardless...) |
We have an agreement that we want to track errors coming back from the push adapter into the _PushStatus object, so a user can at a later time identify which installation has an invalid deviceToken. I believe this is clear enough as a description, and his gives you the freedom to implement it the way you feel is best. Also if uou’re Not able to start it, either immediately or in a foreseeable future, you don’t really need that feature, nor to discuss it this much is such short amount of time. Again I could be mistaken, but it feels nothing has much moved forward and we’ve both wasted our time on words rather than code, given that what you expect would pretty much take only a few minutes to write and about an hour of adding tests. |
I hear you. For me, if we had tentative agreement on what the field looked like in |
And so what if the PR is rejected or require rework? Does it never happen that at code review a better solution arises? Or that when implementing you realize things don’t fit the pre agreed mold? What if the solution is just to write a properly structured log because it works better for you? Wouldn’t it be a waste? Do you believe the time we spend here is not more wasteful than the time it would take to implement, and rework the said PR? |
I thought if we chatted briefly for a few minutes we'd land on what we wanted to see in |
@halvini please update to the latest version of parse-server that now uses the HTTP/2 interface to APNS. It should yield significantly less logs and open a new issue if it persists. @alexblack, I stated my point loud and clear, and you should probably take what I say and work from it. I am not against your proposal, and waiting for an implementation as well as suffisant testing on your side that would ensure we’re not doing all of that for nothing. |
@flovilmart if we had some tentative agreement on what we'd like to see in If we can't get agreement there, I'd still hope we can contribute to this great project somehow. Its definitely a huge help for us. |
Please stop it. What are you expecting? That i’ll Sign off right now on your prospective PR because we agreed on the naming? Ok the name is approved! Now if you want to implement it go ahead! |
I was hoping for some feedback that this looked like what you wanted, or, it didn't. |
Go ahead with that, and run in on your infra for a week |
@flovilmart thanks for the response! Guys, please don't shoot each other :) |
same error here |
@pcegarra ensure you are using the latest parse server, and the device token is actually valid for your certificate pair. |
@flovilmart
Any idea what can I do? so my server config looks like:
Could be this the problem? |
Can you provide the logs when running with VERBOSE=1? Also the state of the associated _PushStatus object for this push? |
Ok, im going to look with verbose=1, but i dont know how to see the state of the associated _PushStatus object.. |
Make a query to the _PushStatus table and get the most recent object. Or with the verbose logs, you should have the objectId associated with it. |
Parse verbose log:
Query id for KiPDDNApW3 |
From what I can see, everything is fine for that push. In your logs we see at least 3 different pushs intertwined, but, the one with the push status look good, as the expected number of pushs is 3 and the total send / failed is 3 as well |
@flovilmart I've tested It always takes me about 5 remote push notifications within 5 minutes until APNS reports a failed push and the bad device token gets removed. It worked several times, the good device tokens untouched, the bad ones removed. Parse server push configuration:
Tested with: @halvini's case sounds like some kind of mix-up of production and development APNS certificates / device tokens. Note that my parse server configs only includes one APNS certificate per server. Looking at the code I suspect the following cause: Each push certificate creates a provider. The list of providers is sorted by production certificates before development certificates. When sending a push notification, the production provider is tried first, if it fails the development provider is used. Now if a push using an APNS production device token that is sent through the production provider fails for any reason, the push is sent through the development provider, which will identify it as a bad device token. This leads to the removal of the token in parse server because it has been sent to the wrong environment. So in @halvini's case the APNS production server could simply have been unreachable for a brief moment, 3 days after activating the clean-up flag, causing the removal of the good device tokens. If that is the cause of the problem, a solution could be to add a Another solution would be to simply remove the possibility of adding development certificates to parse server in a production environment, i.e. remove the |
@flovilmart, this issue is closed, but can you confirm or dismiss my analysis above? |
Yeah it’s possible that the errors reported when using multiple certificates in production may be problematic. I’ll reopen while we find a proper workaround |
Hi, I'm having the issue when sending push notification to iOS.
We have the latest version of parse. One production certificate, no dev. We were using the token-based authentication (w/ .p8 file) when Push stopped working. Them moved to signing certificate (w/ .p12 file), but with no better luck. Anyone is having or has had this issue? Ideas? Thank you |
Can you please open a new issue and fill out the template? |
I've updated the parse-server to the latest 2.5.3 version and parse-server-push-adapter v 2.0.0 and now my error logs are full of these messages:
There are so many of them that I can't see anything else.
The questions are:
The text was updated successfully, but these errors were encountered: