Inconsistency in FCM notifications

354 views
Skip to first unread message

Sanjeev Badnur

unread,
Sep 10, 2024, 1:55:49 PMSep 10
to Firebase Google Group
Hi Team,

  * Operating System version: Ubuntu 20.04.6
  * Firebase SDK version:  12.4.0 - Firebase admin SDK for Node.js
  * Node.js version:   v20.17.0
  * NPM version: 10.8.2
  * client platforms. : IOS and Android applications

Description :
   Client side are fcm tokens are generated and stored in database.
   Node.js will pick those tokens and have to send the push notifications.

Issue:
    Notifications are being pushed to the tokens, but sometimes there is a failure response from Firebase. With the same token, notifications are occasionally sent successfully, and the client is able to receive them.
There is inconsistency in the notification delivery.

Code :
 const firebaseAdmin = require("firebase-admin");
const serviceAccount = require("../adminsdk-fcm.json");

firebaseAdmin.initializeApp({
  credential: firebaseAdmin.credential.cert(serviceAccount),
  databaseURL: "url",
});

let responses = await firebaseAdmin
          .messaging()
          .sendEachForMulticast(message);


 Possible error codes during sending the notifications from server side
1. {"success":false,"error":{"code":"messaging/mismatched-credential","message":"SenderId mismatch"}}

2. {"success":false,"error":{"code":"messaging/unknown-error","message":"Operation is not implemented, or supported, or enabled. Raw server response: \"{\"error\":{\"code\":501,\"message\":\"Operation is not implemented, or supported, or enabled.\",\"status\":\"UNIMPLEMENTED\"}}\""}}

3. {"success":false,"error":{"code":"messaging/registration-token-not-registered","message":"Requested entity was not found."}}
Reply all
Reply to author
Forward
0 new messages