I am getting error while sending message using Firebase
cloud messaging admin API
.
Error message is below
Caused by:
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)
.
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
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
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
I had my project name uppercased in the URL (strange, because my project name is actually uppercased)