最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - Firebase messaging().sendMulticast(...)<--- sendMulticast does not exist on type Messaging - Stack Overflow

programmeradmin0浏览0评论

Recently, I've been working on a new feature for my project.

But I encountered lot of issues with the back-end while implementing the feature.

        // Use messaging() directly from firebase-admin import
        const sendResult = await messaging().sendMulticast(multicastMessage); // <--- Error here, sendMulticast(...) do not exist on type Messaging

I'm trying to implement a push notification feature, using Firebase, Nest.js and other frameworks.

In the code I'm trying to send a notification. The error part is trying to Constructs a multicast message and sends it using messaging().sendMulticast().

Recently, I've been working on a new feature for my project.

But I encountered lot of issues with the back-end while implementing the feature.

        // Use messaging() directly from firebase-admin import
        const sendResult = await messaging().sendMulticast(multicastMessage); // <--- Error here, sendMulticast(...) do not exist on type Messaging

I'm trying to implement a push notification feature, using Firebase, Nest.js and other frameworks.

In the code I'm trying to send a notification. The error part is trying to Constructs a multicast message and sends it using messaging().sendMulticast().

Share Improve this question edited Feb 6 at 15:56 Frank van Puffelen 599k85 gold badges888 silver badges858 bronze badges Recognized by Google Cloud Collective asked Feb 6 at 15:06 ShibaDevShibaDev 54 bronze badges 1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Bot Commented Feb 6 at 15:29
Add a comment  | 

1 Answer 1

Reset to default 1

You're using APIs that are no longer part of recent versions of firebase-admin since version 13. You will need to upgrade your code.

According to the examples in the documentation, firebase-admin doesn't export a function called messaging. The examples all show use of getMessaging.

Also, sendMulticast has been removed from recent versions of firebase-admin. The replacement is sendEachForMulticast.

Read the release notes for the Firebase Messaging in the Admin SDK version 13:

Removed deprecated sendAll(), sendMulticast(), sendToDevice(), sendToDeviceGroup(), sendToTopic(), and sendToCondition() APIs.

This is confirmed in the API documentation for getMessaging. It returns a Messaging object which has a method sendForEachMulticast.

发布评论

评论列表(0)

  1. 暂无评论