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

Requested entity was not found on iOS device #135

Open
AlvinStefanus opened this issue Nov 16, 2022 · 0 comments
Open

Requested entity was not found on iOS device #135

AlvinStefanus opened this issue Nov 16, 2022 · 0 comments

Comments

@AlvinStefanus
Copy link

AlvinStefanus commented Nov 16, 2022

When I tried to send a push notification from my node.js server, the iOS devices got this error:

Requested entity was not found

The code to send the notification is this:

var admin = require("firebase-admin");

// Get it from firebase console -> service accounts
var serviceAccount = require("../fcmKey.json");

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
});

export const sendFCM = (dest: string[], title: string, content: string) => {
  const msg = {
    data: { title, content },
    notification: {
      title,
      body: content,
    },
    tokens: dest,
  };

  admin
    .messaging()
    .sendMulticast(msg)
    .then((response: any) => {
      // Response is a message ID string.
      console.log("Successfully sent message:", response);
    })
    .catch((error: any) => {
      console.log("Error sending message:", error);
    });
};

I read that the token should be refreshed, but this library does not have a way to refresh the token.

Please advice.

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

No branches or pull requests

1 participant