Uh oh!
There was an error while loading. Please reload this page.
Allow fcmOptions in payload keys - #629
Conversation
In #597 support was added for `fcmOptions` for specifying the analytics label for notifications. Unfortunately, the allowable list of keys wasn't updated to support it.
googlebot
commented
Aug 21, 2019
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
googlebot
commented
Aug 21, 2019
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
parndt
commented
Aug 22, 2019
@hiranya911 I tried to add all the right specs for this to ensure that this change is correct and avoids regressions, which pass locally, but I note that |
parndt
commented
Aug 22, 2019
I opted for this implementation for the index signature: /* Payload for fcmOptions messages */exportinterfaceFcmOptionsPayload{analyticsLabel?: string;[key: string]: string;}you're welcome to edit the PR to adjust if this isn't suitable 😄 or just let me know what to change. Thanks! |
hiranya911
commented
Aug 22, 2019
I have a few concerns with this change.
@chong-shao wdyt? |
parndt
commented
Aug 22, 2019
Thanks @hiranya911 for the review. For some extra context which may help with deciding about this PR, here's how we're using this code inside a cloud function using messaging.sendToDevice: constadmin=require('firebase-admin')admin.messaging().sendToDevice(pushToken,data: {custom_notification: JSON.stringify(Object.assign({ deepLink,show_in_foreground: true},notification)),
deepLink,},fcmOptions: {analyticsLabel: 'test.analytics.label',},notification,)We saw this error: {Error: Messagingpayloadcontainsaninvalid"fcmOptions"property.Validpropertiesare"data"and"notification".I guess that is triggering usage of the legacy APIs when using MessagingPayload; is there another way to do this that uses the non-legacy API and allows us to use Thanks for your time! 😄 |
hiranya911
commented
Aug 22, 2019
You're using the legacy FCM APIs ( |
hiranya911
commented
Aug 22, 2019
@parndt please take a look at the Node.js examples on this page and update your code to use the new API: https://firebase.google.com/docs/cloud-messaging/send-message The old API doesn't support |
parndt
commented
Aug 22, 2019
Thanks a lot! 🙇♂️ that's exactly what I needed. |
In #597 support was added for
fcmOptionsfor specifying the analytics label for notifications.Unfortunately, the list of valid payload keys wasn't extended to support it.