firebaseMessaging.sendEachForMulticast: app/network-error
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 50/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- node.js, typescript
- Domain
- backend
Research direction
Start from the firebaseMessaging.sendEachForMulticast call shown in the issue and reproduce the app/network-error with firebase-admin 13.0.2 in development mode. Compare its behavior with the working send method and inspect the returned response. Done means multicast sends successfully without the HTTP/2 protocol error, or the failure is documented with a confirmed cause and workaround.
Written by the indexing model from the issue text.
Description
export async function pushNotification({
identifiers,
body,
metadata,
title,
link,
}: PushMessage) {
try {
logger.debug(`Push Notification: ${JSON.stringify(identifiers)}`);
const userPreIdentifiers = identifiers.users;
const teamPreIdentifiers = identifiers.teams;
const userIdentifiers: string[] = [];
if (userPreIdentifiers === "allUsers") {
const allUserIdentifiers = await getAllUsersIdentifiers();
userIdentifiers.push(...allUserIdentifiers);
} else {
const userTokens = await getUserIdentifiers({
userRefs: userPreIdentifiers || [],
});
userIdentifiers.push(...(userTokens || []));
}
const teamIdentifiers = await getTeamIdentifiers({
teamRefs: teamPreIdentifiers || [],
});
const tokens = [...(userIdentifiers || []), ...(teamIdentifiers || [])];
logger.debug("All tokens:", tokens);
if (tokens.length === 0) {
logger.debug("No tokens found for push notification");
return;
}
const message: MulticastMessage = {
tokens,
notification: {
title,
body,
},
data: metadata as { [key: string]: string },
...(link && {
webpush: {
fcmOptions: {
link,
},
},
}),
};
const response =
await firebaseConfig.firebaseMessaging.sendEachForMulticast(message);
logger.debug(
`Successfully sent push notification: ${JSON.stringify(response)}`
);
} catch (error) {
logger.error("Error sending push notification:", error);
}
}
{"responses":[{"success":false,"error":{"code":"app/network-error","message":"Error while making request: Stream closed with error code NGHTTP2_PROTOCOL_ERROR. Error code: ERR_HTTP2_STREAM_ERROR"}}],"successCount":0,"failureCount":1}
I am using the "firebase-admin": "^13.0.2", sdk. The sendEachForMulticast not working on my development mode (did not try yet in production). However, if I am using the send method it will successfully push the notification.
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 419
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-node
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 comments · 1 assignee ·
-
api: messaging
Difficulty 3/5 1-2 days Newbie friendliness 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
Difficulty 5/5 Over a week Newbie friendliness 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 comment · 1 assignee ·
All issues in firebase/firebase-admin-node
Similar issues
-
blocklist removal
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pastelsky/bundlephobia#1122 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100