Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

275
Vistas
messaging.requestPermission is not a function

trying to send push notification to app but i need permission from user for that but getting this error that messaging.requestPermission is not a function , here is my code for push notification.js file

import * as  firebase from 'firebase/app';
import { getMessaging } from "firebase/messaging";
export const  initializeFirebase = () => {
  firebase.initializeApp({
    apiKey: "",
    authDomain: "",
    projectId: "pushnotification-9b180",
    storageBucket: "pushnotification-9b180.appspot.com",
    messagingSenderId: "878043563283",
    appId: "1:878043563283:web:c2a44f3c8b02ad8a17c6e6",
    measurementId: "G-GMWQKL94ZD"
  });
}
 
export const askForPermissionToReceiveNotifications = async () => {
    try {
      const messaging = getMessaging();

      await messaging.requestPermission();
      const token = await messaging.getToken();
      console.log('Your token is:', token);
      
      return token;
    } catch (error) {
      console.error(error);
    }
  }

Here is the screenshot of errorserros

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda