again I have some troubles with Push notifications
The same code worked a few weeks ago. Yesterday I accidentally noticed that push notifications are not working anymore. I'm doing the same as written in the documentation.
I use NuxtJS without @nuxtjs/messaging because it doesn't support the latest Firebase version.
Here is my code for "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)
})
On the server side everything is okay:

Update 1 First time everything works time, problems occurs after X time. When I manually registered / unregistered service workers it started to work again
Update 2 I started a diary to catch a moment when problem occurs, then I noticed that push notifications stops to work after every deploy