firebase-admin-node: messaging/internal-error only IOS
code is working fine when I try to send notification on android but it does not work for IOS notification. Getting the below error:
{
"results": [
{
"error": {
"code": "messaging/internal-error",
"message": "An internal error has occurred. Please retry the request."
}
}
],
"canonicalRegistrationTokenCount": 0,
"failureCount": 1,
"successCount": 0,
"multicastId": 8118740071861272000
}
This is my code sample
return await admin.messaging()
.sendToDevice(deviceToken, {
data: {
title: 'Test Fcm',
body: 'tesing fmc body',
content_available: 'true',
priority: 'high',
requestId: '1',
doctorId: '1',
name: 'waqas',
patientId: '1',
action_type: 'TEST'
},
notification: {
title: 'Test Fcm',
body: 'tesing fmc body',
content_available: 'true',
priority: 'high'
}
}
, {
priority: "high",
timeToLive: 60 * 60 * 24,
contentAvailable:true,
}).catch(err => {
console.log(err);
})
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (3 by maintainers)
This is still not reliably working for me. I have ‘body’ instead of ‘text’, and I don’t have ‘content-available’ in the payloads. It only randomly fails, works 80-90% time.
Found the issue - They recently changed it on FCM so they do not allow to sent TEXT and BODY keys. From now on - we should only use the “Body”. Once I removed the “Text” key from the notification object - everything works fine again.
My Code is Nodejs, Its not working only IOS , Android is working fine Error return : internalServerError async function PNF(data){ var fcm = new FCM(process.env.FCM_KEY); var message = { to:data.token, code:data.code, data:data.body, notification: { title: ‘Posterz’, body: data.title, sound: “ping.aiff”,
}
Any updates on this? We have this error happening intermittently; overall we can’t seem to use Firebase reliably to send notifications to users, and our users depend on it.
they answered me in this way:
I removed
"contentAvailable"
in the payload.options object and it worked 👍