firebase cloud messaging Request contains an invalid argument

前端 未结 5 956
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 11:24

I am getting error while sending message using Firebase cloud messaging admin API.

Error message is below

Caused by:

相关标签:
5条回答
  • 2021-01-04 12:07

    I suspect that your registrationToken has an invalid format. It should be 152 characters.

    To confirm that, try building your message with setTopic("test") instead of setToken(registrationToken).

    0 讨论(0)
  • 2021-01-04 12:08

    In my case, the problem was that certain keys are not allowed in a notification data payload. Specifically, the key 'from' is forbidden.

    Firebase data message payload

    0 讨论(0)
  • 2021-01-04 12:12

    Yet another cause of this is that your message is too large:

    Notification messages can contain an optional data payload. Maximum payload for both message types is 4KB, except when sending messages from the Firebase console, which enforces a 1024 character limit.

    https://firebase.google.com/docs/cloud-messaging/concept-options

    0 讨论(0)
  • 2021-01-04 12:17

    One possible cause for this is that the client and server are connected to different firebase projects. Project name appears in the google-services.json file on the client and in the credentials json on the server.

    Firebase FCM: invalid-argument

    0 讨论(0)
  • 2021-01-04 12:23

    I had my project name uppercased in the URL (strange, because my project name is actually uppercased)

    0 讨论(0)
提交回复
热议问题