skip to Main Content

JS/Firebase – messaging.onBackgroundMessage is not a function

Here is my whole code: import { initializeApp } from "https://www.gstatic.com/firebasejs/9.16.0/firebase-app.js"; import { getMessaging, getToken } from "https://www.gstatic.com/firebasejs/9.16.0/firebase-messaging.js"; //This data is filled correctly just clearing it here for the question const firebaseConfig = { apiKey: "", authDomain: "", projectId: "t",…

VIEW QUESTION

Reference error: self is not defined when implementing firebase messaging

In my Nextjs project I'm trying to implement push notification with firebase messaging (my firebase version is 8.10.0), after creating the firebase-messaging-sw.js file in my public folder: importScripts( "https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js" ); importScripts( "https://www.gstatic.com/firebasejs/8.10.0/firebase-messaging.js" ); const firebaseConfig = { apiKey: "***", authDomain:…

VIEW QUESTION

Firebase Function deployment fail

This firebase function which triggers firebase messaging fails due to unknown error import * as functions from "firebase-functions"; import * as admin from "firebase-admin"; const messaging = admin.messaging(); export const sendChatNotification = functions.firestore.document('chats/{chatId}/messages/{messageId}').onCreate(async (snapshot) => { const message = {…

VIEW QUESTION

I'm using firebase messaging in my flutter app but when I run my project it show Stringtoken=FirebaseInstanceId.getInstance().getToken(senderId, "*");

I'm using firebase messaging in my flutter app but when I run my project it show String token = FirebaseInstanceId.getInstance().getToken(senderId, "*"); when I run my application it shows this error in the console: C:UserscerbiAppDataLocalPubCachehostedpub.dartlang.orgfirebase_messaging-9.1.4androidsrcmainjavaioflutterpluginsfirebasemessagingFlutterFirebaseMessagingPlugin.java:166: error: cannot find symbol String token…

VIEW QUESTION
Back To Top
Search