Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Las notificaciones push de Firebase dejaron de funcionar en NuxtJS

de nuevo tengo algunos problemas con las notificaciones Push

El mismo código funcionó hace unas semanas. Ayer noté accidentalmente que las notificaciones automáticas ya no funcionan. Estoy haciendo lo mismo que está escrito en la documentación .

Uso NuxtJS sin @nuxtjs/messaging porque no es compatible con la última versión de Firebase.

Aquí está mi código para "firebase-messaging-sw.js":

 importScripts('https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js') importScripts('https://www.gstatic.com/firebasejs/8.10.0/firebase-messaging.js') // Initialize the Firebase app in the service worker by passing in // your app's Firebase config object. // https://firebase.google.com/docs/web/setup#config-object firebase.initializeApp({ apiKey: '###', authDomain: '###', databaseURL: '###', projectId: '###', storageBucket: '###', messagingSenderId: '###', appId: '###', measurementId: '###', }) // Retrieve an instance of Firebase Messaging so that it can handle background // messages. const messaging = firebase.messaging() let pushUrl = '' messaging.onBackgroundMessage((payload) => { console.log('Received background message ', payload) // Customize notification here const notificationTitle = payload.data.title const notificationOptions = { body: payload.data.body, url: payload.data.url, link: payload.data.url, icon: './icon-for-push.png', } pushUrl = payload.data.url self.registration.showNotification(notificationTitle, notificationOptions) }) self.addEventListener('notificationclick', (e) => { e.notification.close() return self.clients.openWindow(pushUrl) })

En el lado del servidor todo está bien: ingrese la descripción de la imagen aquí

Actualización 1 La primera vez que todo funciona a tiempo, los problemas ocurren después de X tiempo. Cuando registré / no registré manualmente a los trabajadores de servicio, comenzó a funcionar nuevamente

Actualización 2 Comencé un diario para capturar un momento en que ocurre un problema, luego noté que las notificaciones automáticas dejan de funcionar después de cada implementación

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!