目前我正在試圖發送一個PushNotification
到Device Group
使用FCM
與Firebase Cloud Functions
的幫助,但一旦通知發出,它的代碼200
返回,但失敗:火力地堡FCM錯誤:「InvalidRegistration」
SUCCESS response= {
multicast_id: 8834986220110966000,
success: 0,
failure: 1,
canonical_ids: 0,
results: [ { error: 'InvalidRegistration' } ]
}
這是我用來發送此通知的代碼...我錯過了什麼?
const options = {
method: 'POST',
uri: 'https://fcm.googleapis.com/fcm/send',
headers: {
'Authorization': 'key=' + serverKey,
},
body: {
to: groupId,
data: {
subject: message
},
notification: {
title: title,
body: body,
badge: 1,
},
content_available: true
},
json: true
};
return rqstProm(options)
.then((parsedBody) => {
console.log('SUCCESS response=', parsedBody);
})
.catch((err) => {
console.log('FAILED err=', err);
});
凡JSON值title
,body
,subject
,message
是String
這實際上並沒有回答這個問題,我也從一個節點JS後端使用完全不同的方式獲得相同的錯誤。 – mic