-
-
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
feat: Send Android push notifications to Firebase Cloud Messaging API (HTTP v1) by setting the push adapter option firebaseServiceAccount
#222
Conversation
Thanks for opening this pull request!
|
If I understand this PR correctly, you are adding a "raw FCM support" to the adapter, correct? That just to clarify, because this push adapter already has FCM support, in fact I believe GCM has been first deprecated in 2019 and has already been turned off by now. In code the term "GCM" is still used, but the payload is handled by dependency
I don't think so, because we'd force a developer to use a 3rd party service (Firebase) to send a push to APNS. But I think you're making a good point; it should be configurable to use FCM also for Apple devices. So we'll probably need a new adapter option to configure the routing according to Since this is our current adapter config structure: push: {
android: {
apiKey: '...'
},
ios: {
pfx: '/file/path/to/XXX.p12',
passphrase: '', // optional password to your p12/PFX
bundleId: '',
production: false
}
} It's based on device type The "raw" FCM payload would be a breaking change from the current FCM payload if I'm not mistaken. We don't want this to be a breaking change, so while I think it makes sense allow to pass this "raw" payload, we would need an additional change to adapt the current "GCM" file to use the firebase-admin SDK while maintaining the current payload structure. But since you have already managed to write the "raw" FCM code, it would just require a payload conversion I assume? I'd split this up into 2 changes (in 2 PRs if you like):
|
Correct, and I agree with all points listed above. Mostly wanted to get something working quick for myself to begin with ;) |
Great, and thanks for taking this on, this is really a key issue for many Parse Server deployments. |
@mtrezza You mentioned this: GCM uses "apiKey" which is not compatible with the FCM v1 API. Instead, I added some logic so GCM payloads are supported in the FCM module. If "rawPayload" is present in the Parse.Push.send method it will use the raw FCM payload instead. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #222 +/- ##
============================================
- Coverage 100.00% 81.38% -18.62%
============================================
Files 5 6 +1
Lines 277 360 +83
============================================
+ Hits 277 293 +16
- Misses 0 67 +67
☔ View full report in Codecov by Sentry. |
@jimnor0xF Would you be so king and rebase this PR to resolve the conflicts? I've done some upgrading in other PRs. |
* Uses FCM if firebaseServiceAccount key is present in config.
f3e5f2c
to
ccdb678
Compare
Rebased. |
The package-lock has a suspiciously large change, even though only 1 dep has been added; could you please use the file from |
@jimnor0xF Apologies, I wrote |
Thanks, running CI... |
Credit goes to: https://github.com/jimnor0xF PR & Discussion: parse-community#222
Hey, just wanted to say thank you for this PR @jimnor0xF, I've put it into use in my project to send pushes using FCM and it's working great. Hope it gets merged into master soon. |
firebaseServiceAccount
firebaseServiceAccount
firebaseServiceAccount
and adapt the push payload accordingly
firebaseServiceAccount
and adapt the push payload accordinglyfirebaseServiceAccount
firebaseServiceAccount
firebaseServiceAccount
# [5.1.0](5.0.2...5.1.0) (2024-03-02) ### Features * Send Android push notifications to Firebase Cloud Messaging API (HTTP v1) by setting the push adapter option `firebaseServiceAccount` ([#222](#222)) ([be40b1d](be40b1d))
🎉 This change has been released in version 5.1.0 |
Hello, I'm experiencing issues with integrating Firebase Cloud Messaging using a service account on Heroku with Base Installation: parse-server@7.1.0-alpha.6 works with the legacy GCM API. Issue with FCM Service Account: Problems begin when configuring the firebaseServiceAccount for FCM. Configuration Details: I exported the service account JSON file from the Google Cloud Console. Set up the service account credentials in the server configuration as follows:
I also tried using JSON.stringify on the object. Alternative Attempt: I've also tried etting the firebaseServiceAccount as a path to the JSON file as suggested in
Both methods result in a generic Heroku error, and I'm unable to find relevant documentation on setting up the new FCM authentication method using a service account. Could you provide any insights or guidance on what might be causing these issues or how to resolve them? |
There is a fix we'll merge. If you then still encounter a bug please open a new GitHub issue. Note that we don't use GitHub for support. For help with Parse Platform we recommend our community forum or our community chat. |
New Pull Request Checklist
Issue Description
Closes #219.
Adds FCM support to the parse-server-push-adapter.
Approach
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
Payload example:
TODOs before merging