Firebase-admin-node: messaging/internal-error only IOS

Created on 19 Aug 2020  路  11Comments  路  Source: firebase/firebase-admin-node

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);

       })

```

messaging

Most helpful comment

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.

All 11 comments

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.

Was this page helpful?
0 / 5 - 0 ratings