jlcvp / fcm-node

A Node.JS simple interface to Google's Firebase Cloud Messaging (FCM) for Android & iOS & Web Notification and data push
MIT License
125 stars 48 forks source link

InvalidServerResponse #15

Closed Bishalsingh closed 7 years ago

Bishalsingh commented 7 years ago

Since last two days, InvalidServerResponse error gets displayed every single time. No code changes and this thing was working before.

jlcvp commented 7 years ago

@Bishalsingh can you provide more info? How is the object you're sending? any especial character?

cryser29 commented 7 years ago

@Bishalsingh I had got the same issue one hour ago. I just added one line with console.log to the library code and was able to see the actual reason of the error. In my case the error was caused by wrong Server key. I added redundant quotes around the key. Once I removed them everything became working properly.

jlcvp commented 7 years ago

Note that your server key might have changed in your firebase console. it happened to one of my projects once.

jlcvp commented 7 years ago

You can recheck your key at https://console.firebase.google.com/project/_/settings/cloudmessaging

renanrosalojasmm commented 6 years ago

I am having the same issue. I already checked my key and it's fine.

wuestkamp commented 5 years ago

Same issue, key is fine if I fire manually via curl. For me it was that the message was not correct:

const message = {
      to: fcmTokens,
      notification: {
...

needs to be:

const message = {
      registration_ids: fcmTokens,
      notification: {
...
jlcvp commented 5 years ago

@wuestkamp indeed, the key to was meant to be used in messages to ONE SINGLE device. For multicast messages, we need to use the key registration_ids. If i get some free time these days I can make an implementation to check these cases and informe more clearly than FCM itself

1211amarsingh commented 5 years ago

change key of inner variable of data.. if u use (message_type) as key ... server will send InvalidServerResponse

gotocva commented 3 years ago

@1211amarsingh I too facing same issue your message helped me a lot. thank you so much

varun22mittal commented 2 years ago

@jlcvp did you find any solution of this

jlcvp commented 2 years ago

@varun22mittal I'm not maintaining this lib anymore, I strongly recommend you to use the firebase's official node sdk