firebase cloud messaging Request contains an invalid argument

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).


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