Repository navigation
when sending push notification for android, I got MismatchSenderId error #704
Description
Activity
- changed the title
[-]when enabling push notification for android, do we need two different gcm keys? for for server and one for client. It is not clear in the document.[/-][+]when enabling push notification for android, do we need two different sender id and api key? for for server and one for client. It is not clear in the document.[/+]on Feb 27, 2016 I have created GCM credentials and enabled Google Cloud Messaging in google cloud platform. I also added the push senderId and apiKey in Parse Server's index.js
var api = new ParseServer({ . . . push: { android: { senderId: 'Project number', apiKey: 'XXXXXXXX' } } });when I test sending push using the following REST api call:
curl -X POST \ -H "X-Parse-Application-Id: myAppId" \ -H "X-Parse-Master-Key: foo" \ -H "Content-Type: application/json" \ -d '{ "where": { "deviceType": { "$in": [ "android" ] } }, "data": { } }' \ https://fast-badlands-XXXXX.herokuapp.com/parse/pushI saw this log:
GCM request and response {"request":{"params":{"priority":"normal","data":{"time":"2016-02-27T22:19:17.914Z","push_id":"PASML5ShpI","data":"{\"friendRequestUpdate\":0}"}}},"response":{"multicast_id":5176387894691562000,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}}why does it return MismatchSenderId error?
- changed the title
[-]when enabling push notification for android, do we need two different sender id and api key? for for server and one for client. It is not clear in the document.[/-][+]when sending push notification for android, I got MismatchSenderId error[/+]on Feb 27, 2016 Was this an installation migrated from parse.com? Is that the senderId which was used to register this device?
How will installation affect REST api call from command line? In my test, there are no installations migrated from parse.com. When I delete all the installations on mongodb and run the test push command, server logs shows the same error of MismatchSenderId.
It also logs
Can not find sender for push type ios, {"where":{"deviceType":{"$in":["android"]}},"data":{}}
But I think it is unrelated as I didn't specify iOS push in index.jsOdd! I tested again and now push is successfully received. Nothing has changed in my code. I suspect something fishy was going on in GCM
I found the problem, I put
<meta-data android:name="com.parse.push.gcm_sender_id" android:value="id:xxxxxxxxx" />outside the application section in the AndroidManifest. The app still compiles and runs but I guess the sender_id is not used from the client?
When I move it to inside application, push works.
@gfosco Thanks.
Reacted by Alvaro Dueñas- addedtype:questionSupport or code-level questionSupport or code-level questionand removed
on Jul 11, 2021
Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!
-[ ] You've met the prerequisites.
-[ ] You're running the latest version of Parse Server.
-[ ] You've searched through existing issues. Chances are that your issue has been reported or resolved before.
Environment Setup
Steps to reproduce
Logs/Trace