-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Switch from node-gcm
to firebase-admin
dependency
#219
Comments
Thanks for opening this issue!
|
node-gcm
to firebase-admin
dependency
cc @parse-community/server This is a critical issue that will require everyone to upgrade the push adapter for continued FCM support. |
Added support for this for myself since using APNS and GCM separately together with Flutter and the firebase_messaging package did not play very well. Created a quick draft for this here #222. Not the best at JS, so probably needs to be refined. It uses sendEachForMulticast() which is a bit concerning in its current state: |
@jimnor0xF That's amazing, thanks for taking a lead on this. |
To confirm: Is the current state of parse-server-push-adapter (and thus of parse-server) that it does not support the new API, so if nothing changes, parse-server won't work with Firebase after June 2024 (4 months from now)? |
In the current state only APNS based push notifications (Apple only) will work after June 2024. Haven't looked at this issue in a while, been busy with other things. But I guess what remains here to get this merged in is adding some tests and a code review. I've been running this in production for quite some time with no problems. |
Basically for the review of the existing PR we just need to make sure it's not a breaking change for people who are for example using the current API that will be removed in June. And at least a few tests. But it's good to know that this is running fine in production for a while already. |
@jimnor0xF Thank you for implementing this fix for everyone. This would have been a disaster for legacy systems. @mtrezza When will this be merged? |
We'd need someone to test the PR out with their current set-up for node-gcm, so we know whether the push adapter still works without forcing to switch to the new API. |
I’ve made a note to try this out in our staging environment in a few weeks, during our next cooldown. If anyone is willing to write up specific instructions on how to test it (the package.json incantation for Parse to use this version of the push adapter; what auth to get from FCM; how to configure it in Parse), that would lower the barrier a lot and I’m sure more people would be happy to test it. |
@mtrezza https://firebase.google.com/docs/cloud-messaging/migrate-v1#update-authorization-of-send-requests However, it should support the same push payload format that was used with node-gcm. |
@jimnor0xF I meant that when using the current configuration of the deprecated API, the adapter should work without any changes necessary in the config or code. In other words, when upgrading the adapter to the new version with that PR, it should work using the deprecated API, and if someone wants to use the new API they just have to change the adapter config in the Parse Server options. The push payload should stay the same, regardless of which API is being used. Is that currently the case? |
@mtrezza It should also support the old GCM push payload format. An additional key was also added to be able to use raw FCM payloads. I can add a test spec with some mocks to make sure this is the case. |
That would be great, so I'll wait with merging. And just to be sure, with the PR it's still possible to use APNS directly for Apple pushes and at the same time the new firebase-admin API only for Android pushes? In other words, the |
I've merge the PR to make the feature available more quickly, but we are still lacking a small PR with the proper documentation for the feature, specifically the options |
@mtrezza Regarding the section in README, sure, I can add that. I also have some tests I've written. Can we put that into the same PR perhaps? |
Sure, same PR is fine. Would it be a lot of work to add the APNS implementation so that developers won't have to deal with rawPayload for Android and their usual payload for APNS? That could benefit a lot of developers, given that the API deprecation in June will affect the majority of Parse Sever deployments. |
@mtrezza switch (pushType) {
case 'ios':
case 'tvos':
case 'osx':
if (pushConfig[pushType].hasOwnProperty('firebaseServiceAccount')) {
this.senderMap[pushType] = new FCM(pushConfig[pushType], pushType);
} else {
this.senderMap[pushType] = new APNS(pushConfig[pushType]);
}
break;
case 'android':
case 'fcm':
if (pushConfig[pushType].hasOwnProperty('firebaseServiceAccount')) {
this.senderMap[pushType] = new FCM(pushConfig[pushType], pushType);
} else {
this.senderMap[pushType] = new GCM(pushConfig[pushType]);
}
break;
} |
Yep, sounds good |
Keeping this issue open for now as we are still not quite there yet it seems, see #237. |
#237 has been closed, so closing this as well. |
New Feature / Enhancement Checklist
Current Limitation
The push adapter is depending on https://github.com/parse-community/node-gcm, which is using a now deprecated API for Google's FCM. The API will be decommissioned in June 2024:
It's unclear at this point whether the community of the original node-gcm repository will adapt the
node-gcm
to the new API, especially since Firebase provides a native SDK as alternative with firebase-admin-node.Feature / Enhancement Description
Evaluate whether to adapt node-gcm or switch to the firebase-admin-node. If the community of the original node-gcm repository won't update it, then the initial assumption is that switching to the native SDK will bring more benefits over the long run, as it will be maintained by Google and receive continuous updates. The effort required to switch may be similar to the effort required to adapt node-gcm.
The text was updated successfully, but these errors were encountered: