TypeError: firebase.messaging is not a function in node.js

前端 未结 5 1989
我在风中等你
我在风中等你 2021-01-17 19:58

While trying to fetch the FCM messages in node.js using firebase module, following error \"TypeError: firebase.messaging is not a function\" is occurring.

v         


        
5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-17 20:31

    The documentation for Firebase does not make it clear that there is a difference of features available based on the current environment. firebase.messaging is not available to a Node.js client, but is available from the firebase-admin package. However, this package alone comes with a different set of features specfically for firebase.messaging.

    You can see what's available to you based on your environment in the Firebase Reference docs. Specifically for your case the Node.js (Client) section.

提交回复
热议问题