Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest versions of Parse Server and the Parse Server Push Adapter.
Issue Description
I have an existing code that is sending push notifications to both Android and iOS via the same call. The invocation in the cloud code looks like this:
return Parse.Push.send({
where: query,
expiration_interval: 36000, // NOTE: in seconds this is 10 hours
data: payload
})
where payload
has been set to:
payload = {
alert: {
"body": "something",
"title": "title",
},
"sound": "myfancysound.wav",
"mutable-content": 1,
"threadId": "something",
"url": "https://something...",
"interruptionLevel": "time-sensitive"
}
You can see that it uses default iOS alert
dictionary with couple of standard iOS params (interruptionLevel
, mutable-content
, ...) as well as user defined params (for example url
).
Updating to the latest parse-server-push-adapter@6
and adding firebaseServiceAccount
to the Android configuration does not work out of the box:
Actual Outcome
Error 1: Error: android.data must only contain string values
Using the existing code and just reconfiguring android
push adapter config to use firebaseServiceAccount
does not work.
erbose: _PushStatus 1H56NNwx6E: sending push to installations with 1 batches
verbose: Sending push to 1
info parse-server-push-adapter FCM sending push to 1 devices
ERR! parse-server-push-adapter FCM error sending push: Error: android.data must only contain string values
verbose: _PushStatus 1H56NNwx6E: sent push! 0 success, 0 failures
This indicates that the push notification was correctly targeted and posted to FCM API, however FCM API returned an error android.data must only contain string values
. This is most probably coming from the fact that push data contain an alert
dictionary with body
and title
instead of using just flat alert
and title
.
Flattening the payload makes the error go away, but:
payload = {
"alert": "something",
"title": "title",
"sound": "myfancysound.wav",
"mutable-content": 1,
"threadId": "something",
"url": "https://something...",
"interruptionLevel": "time-sensitive"
}
Parse log output is:
verbose: _PushStatus 28Tg8rzqsZ: sending push to installations with 1 batches
verbose: Sending push to 1
info parse-server-push-adapter FCM sending push to 1 devices
verb parse-server-push-adapter FCM tokens with successful pushes: ["f6d_Lyr6TH6OZhFLRMFDfs:APA91bH-ywNh186FRsx7XmzBKIjBZq4rFiKRTcCdiPXtiFmhF6oMKr-Lwwytise4TV0kAU_s4XVB6JpGShyga92oMUlr98mU5CcPYIrarTE2BJdHIaWBH6Rqff4exx50rzQGjwySZpfR"]
verbose: _PushStatus 28Tg8rzqsZ: sent push! 1 success, 0 failures
Error 2: Notification does not show up on Android device
The client side SDK receives a RemoteMessage
with Bundle
containing all the keys passed to sendPush
but does not contain the data
key, thus the code below returns null
for all important params and push notification, despite reaching the device just gets silently dropped in handlePush
.
Expected Outcome
I would expect existing code to either work or get some pointers how to adapt it to work using the new adapter.
Environment
Client
- Parse Server Push Adapter version: 6.0.0
Server
- Parse Server version: 7.0.0