dart_firebase_admin icon indicating copy to clipboard operation
dart_firebase_admin copied to clipboard

FirebaseMessagingAdminException: messaging/invalidargument: One or more arguments specified in the request were invalid.

Open scalz opened this issue 10 months ago • 0 comments

Hello,

thank you for this package, this is nice to have it for Dart :)

When testing sending message to iOS, I get this error: FirebaseMessagingAdminException: messaging/invalidargument: One or more arguments specified in the request were invalid.

This is because critical, availableContent and mutableContent are bool properties, but they are also sent as bool to FCM. Per Apple documentation, these should be sent as int 0/1. https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification

After fixing related _toProto() methods, issue is gone. I simply fixed it like this: fix adminsdk

I can eventually make a PR for these changes. But before that, I would like to be sure:

  • regarding type promotion, do you prefer that I create a local var then test it. Or the Non-null assertion operator is ok ?
  • are you ok if, like in my screenshot, I remove null values so they are not sent to FCM. I think I noticed in Typescript AdminSdk it does not send them. If so do you prefer two separated PR, one for the bool fix, and another one for "skimmed" null values ?

scalz avatar Apr 09 '24 08:04 scalz