firebase-admin-node
firebase-admin-node copied to clipboard
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);
})
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Sorry, this is not a product I am familiar with.
I'm receiving quite the same error using sendToDevice (in the last week)
I'm sending this data:
{
"notification": {
"badge": "1",
"body": "my message",
"title": "my title",
"priority": "high",
"notId": "1599030685610",
"content_available": "1",
"sound": "default",
"forceStart": "1"
},
"data": {
"objID": "jjXZUjl...",
"objOwnerID": "SRj3V4...",
"userActionID": "GK6AM...",
"userRecipientID": "SRj3V...",
"text": "my text",
"type": "new_like",
"subType": "post"
}
}
and FCM returns me this error:
{
"results": [
{
"error": {
"code": "messaging/unknown-error",
"message": "An unknown server error was returned. Raw server response: \"\"InvalidParameters: The data field in the request can not contain duplicate keys.\"\""
}
}
],
"canonicalRegistrationTokenCount": 0,
"failureCount": 1,
"successCount": 0,
"multicastId": 2963338467847546000
}
I tried to contact the support, but still no one answered me.
Maybe something has changed??
they answered me in this way:
This is Yuji. Happy to help you out.
There was an outage regarding internal server errors for iOS devices, that affected a small percentage of users. It will give an error when the request has multiple "content_available" parameters, which is the issue in your case. A number of customers have been affected by a change that was recently made to the API service. The issue was escalated to our engineering team and a mitigation was rolled out.
If you have any other questions or concerns, feel free to reach back. Cheers,
I removed "contentAvailable"
in the payload.options object and it worked 👍
@chong-shao is there anything that should be done in the SDK side for this? Looks like a fix has been deployed at the backend.
There's still remaining work for the backend team on this. I'll provide more updates once the fix is fully deployed.
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.
Hi @superzadeh do you have content_available
set in your request, as the ones posted above in this thread? If so could you try remove content_available
and retry the request?
As for the backend's fix deployment, is has not completed yet.
Hi, i'm having the same issue too, and no i do not have the content_available in my payload
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.
@tomershohet's answer worked very well. Had the issue with Android (iOS still got messages). After removing the "text" Key everything works fine again on both device types.
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.
I'm also seeing about a 75% success rate on iOS push notifications when the app is either in the background or closed. But when the app is in the foreground, the success rate seems to be 100% (across 10 tests). Here's the data I'm sending:
payload = {
token: fcmToken,
notification: {
title: title,
body: message,
},
data: {
body: message,
},
};
Was anyone able to isolate why this happens? Thanks!
Quick update. I just ran another 10 tests today with the app closed and all 10 were a success. So maybe this error sometimes does indicate an actual internal Firebase cloud network issue.
any update about this issue? i am also facing same issue
For the issues posted in comments starting from May 13, this may caused by a separate problem. I'd recommend file a customer ticket through Firebase Support where you can provide more information about your request. The support team will reach out to help. Thanks!
Closing due to inactivity
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",
}
};
console.log(JSON.stringify(message),"======================= android push");
fcm.send(message, function(err, response) {
if(err){
console.log('error found', err);
}else {
console.log('response here', response);
}
})
}