Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

messaging/internal-error only IOS #1000

Closed
waqas740 opened this issue Aug 19, 2020 · 18 comments
Closed

messaging/internal-error only IOS #1000

waqas740 opened this issue Aug 19, 2020 · 18 comments
Assignees

Comments

@waqas740
Copy link

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);
            
          })
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@schmidt-sebastian
Copy link
Contributor

Sorry, this is not a product I am familiar with.

@giuseeFG
Copy link

giuseeFG commented Sep 2, 2020

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??

@giuseeFG
Copy link

giuseeFG commented Sep 3, 2020

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 👍

@hiranya911
Copy link
Contributor

@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.

@chong-shao
Copy link

There's still remaining work for the backend team on this. I'll provide more updates once the fix is fully deployed.

@superzadeh
Copy link

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.

@chong-shao
Copy link

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.

@tomershohet
Copy link

Hi, i'm having the same issue too, and no i do not have the content_available in my payload

@tomershohet
Copy link

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.

@Shadowsith
Copy link

@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.

@isonlaxman
Copy link

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.

@dustinkerstein
Copy link

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!

@dustinkerstein
Copy link

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.

@Sohailze
Copy link

any update about this issue?
i am also facing same issue

@chong-shao
Copy link

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!

@lahirumaramba
Copy link
Member

Closing due to inactivity

@raghav53
Copy link

raghav53 commented Oct 3, 2023

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

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests