Errors with Push Notifications on Parse Server
I have the latest version of the parse-server code, running on AWS Elastic Beanstalk with an mLab database:
- Elastic Beanstalk
- 64bit Amazon Linux 2016.03 v2.1.1 running Node.js (v4.4.3)
- nginx proxy server
- t2.medium single instance hosted in Virginia
- Parse server v2.2.16 (7/10/2016)
- Mongo DB driver (v2.1.18)
- mLab dedicated cluster (v3.0.10)
I am hitting some issues with push notifications between my clients. All the credentials were set up fine for iOS and Android and it was working great. Then, after some time, when I perform some client-to-client operations (for testing) in which one client sends push notifications to another client or group of clients through a Cloud Code method, I start to see some problems.
I get this error in Android Studio: failed with error: Invalid classname: _PushStatus, classnames can only have alphanumeric characters and _, and must start with an alpha character while sending push notification.
Subsequently, when I send any additional push notification through an Android device, it errors out (same error message). Also, when I then try to load the data browser (hosted on parse.com), I see that it fails.
After some debugging, the issue is "resolved" (until it happens the next time) when I remove the _PushStatus document in the _SCHEMA collection. This has happened three times now in the last 24 hours...and is obviously not something that would fly in production.
Is anyone else hitting this problem? How did you fix it? I think the problem is that _PushStatus is not a supported collection that should belong in the mLab schema.
@flovilmart Is this something you've come across/do you have any suggestions? You were super helpful last time! :)
This seems related, too, but I don't see a resolution: https://github.com/ParsePlatform/parse-server/issues/1591
The _PushStatus collection should not cause any issue anymore as it should not be part of the schema. This seems to be a bug.
Working with latest version 2.2.16 - the _PushStatus is created in the Schema and break the server on parse.com side.
@flovilmart I checked the commit you added to fix the issue in April. I noticed that in the latest code, part of that was lost. I have done a point fix on my side and am still testing. It's just a single line in src/Controllers/DatabaseController.js from: https://github.com/ParsePlatform/parse-server/pull/1636
Would incorporating that change back in solve the _PushStatus problem or does more need to be done?
@sprabs I'm not sure what you're referring to. If you want to open a pull request, go ahead.
@flovilmart This is what I mean:
You changed this code https://github.com/ParsePlatform/parse-server/pull/1636 to fix the _PushStatus issue back on April 25th, correct?
If you look at the latest code on master, all your changes have persisted except the one you made in src/Controllers/DatabaseController.js. (Why did that get lost in the first place by the way?) In my local repo, I added that change back to see if that fixes the issue. Do you know if the loss of that change is why the issue has returned? (By that I mean, the fact that that one line change seems to have been blown away?)
The fix for the _PushStatus class was to make it so it's not stored in the _SCHEMA. Maybe that fix was accidentally reverted.
How can we verify this?
check https://github.com/ParsePlatform/parse-server/blame/master/src/Controllers/DatabaseController.js also, I'm still not sure that the change was reverted.
Look at line 98 in the current /src/Controllers/DatabaseController.js that's checked in to master.
previous line: .then(() => schemaController.getOneSchema(className, true))
was replaced with (current code): .then(schemaController => schemaController.getOneSchema(className))
When I reverted this change to the version that is claimed to have worked, I don't seem to be seeing the _PushStatus schema issue anymore. Are there any side effects for this change? Do we know why someone changed it in the first place? Was it an oversight or by design?
Given the blame info, @drew-gross may be able to give more info.
@flovilmart Looks like even with my code change, the issue happened again. There's definitely a bug with src/Controllers/DatabaseController.js
To reproduce this issue:
Send several push notifications (we've sometimes triggered it by just sending 5!) from an iOS or Android client that is pointing to a parse-server endpoint (in our case we have it hosted on an AWS Elastic Beanstalk, but that should not matter). It also doesn't matter who the recipient of the push notification is (it could be another client pointing to parse.com or to parse server).
The _PushStatus collection's schema then gets added to the mLab _SCHEMA collection. At that point, clients that are pointing to parse.com can no longer trigger push notifications (in our case, through a Cloud Code method). However, they can receive push notifications from clients that are pointing to the parse server endpoint.
The deadline is coming, and this is a pretty serious issue for the period of time when we are migrating our clients off of parse.com... Any suggestions for how to fix this? @drew-gross @hramos
Does anyone have updates or suggestions for how to proceed? This affects everyone migrating IMO.
@drew-gross @MBDeveloper @flovilmart @hramos
@sprabs is this bug only affecting dashboard.parse.com?
@flovilmart No, it's breaking any push notifications sent through clients still point to parse.com as well. That's the main issue for us. It's caused by _PushStatus schema being created. Here's the client error: [com.parse.ParseRequest$ParseRequestException: Invalid classname: _PushStatus, classnames can only have alphanumeric characters and _, and must start with an alpha character while sending push notification.]
So basically, we can't migrate until it's fixed because it will take a few weeks for all clients to migrate. We can't have the clients on parse-server breaking push notifications for clients on parse.com every 10-15 minutes...
You can use the parse-dashboard in the meantime no? If this is a really pressing issue for you I encourage you to try to put a PR together and work on a fix that would benefit everyone.
The main issue isn't just the dashboard (as stated above). It's that it breaks push notifications for clients still using parse.com. We extensively tested this. I'll re-post the findings:
Basically, once a set of push notifications are triggered from any client or group of clients pointing to parse-server, at some point the _PushStatus schema gets added. At that point, two things happen: parse.com dashboard breaks AND any clients still using parse.com will error when attempting to send a push notification (in our case through a cloud method).
@flovilmart :/ I've spent time looking at it, but am not sure where to start. Unfortunately, I'm not familiar enough with the parse-server code to add a fix. I was hoping you could help me or at least point me in the right direction since you've worked on this part of the code base before.