Jorge Cuevas
Jorge Cuevas

Reputation: 774

"error" : "MismatchSendedId" when trying to send a Web Push notification

I'm following this guide to learn about web push implementation. I've followed the guide until I encountered a problem when using curl to send a notification:

curl --header "Authorization: key=<PUBLIC_API_KEY>" --header "Content-Type: application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"<SUBSCRIPTION_ID>\"]}"

I changed the API Key and Subscription Id with my Firebase Cloud Messaging key and the Subscription ID generated when the notifications are accepted on the browser.

Still I get this error when executing curl:

{"multicast_id":8346257587601342490,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}

I found this error related to android push notifications but not about web push so the other answers were not useful with my issue.

Has anyone experienced this issue? What am I missing?

Upvotes: 0

Views: 737

Answers (2)

Gideonamani
Gideonamani

Reputation: 36

I was also experiencing the same thing. Even after recheking a dozen of times that the manifest was properly written out and set and that the API_KEY and registration_ids are correct. But I have now noticed that the problem was that I wasn't copying the whole url link. Example if your endpoint url is: endpoint: https://android.googleapis.com/gcm/send/c_hMYQ0IJEg:APA91bHugFROB5EKLlwFKPjc7lRs_YZ7nBV655oftqdKPtzsmoz149d1BLVntgMpRnLHGqTVn6W7n7je4SoezFhfbUMdwxAot

Then the subsctionID will be "c_hMYQ0IJEg:APA91bHugFROB5EKLlwFKPjc7lRs_YZ7nBV655oftqdKPtzsmoz149d1BLVntgMpRnLHGqTVn6W7n7je4SoezFhfbUMdwxAot".

I had been using only the last part as in "APA91bHugFROB5EKLlwFKPjc7lRs_YZ7nBV655oftqdKPtzsmoz149d1BLVntgMpRnLHGqTVn6W7n7je4SoezFhfbUMdwxAot" and I guess that's why I had been getting the errors.

Upvotes: 2

collimarco
collimarco

Reputation: 35390

It means that the service worker installation is associated to a GCM sender that is different from the GCM sender that generated the API key.

From Pushpad troubleshooting:

  • Make sure that you have created and linked the manifest.json
  • Check that you have entered correctly the gcm_sender_id in the manifest.json
  • Check that you have entered correctly the GCM API key

If everything is correct you can also try to unsubscribe and resubscribe after you have set the correct gcm_sender_id.

Upvotes: 0

Related Questions