Open
Description
By some reason push notifications appears twice, I'm sending it via firebase Cloud Messaging interface.
Version
@nuxtjs/firebase: 7.4.1
firebase: 8.2.7
nuxt: 2.14.12
Steps to reproduce
// nuxt.config.js
messaging: {
createServiceWorker: true,
fcmPublicVapidKey:
'MY-KEY', // OPTIONAL : Sets vapid key for FCM after initialization
inject: fs.readFileSync('./js/push.js', 'utf8'),
},
// push js
self.addEventListener('push', function (e) {
const data = e.data.json()
const title = data.notification.title
const options = {
body: data.notification.body,
icon: './icon-for-push.png',
data: {
dateOfArrival: Date.now(),
primaryKey: '2',
url: data.data.url,
tag: 'noty-1',
click_action: data.data.url,
},
}
e.waitUntil(self.registration.showNotification(title, options))
})
Send Push notification via Firebase Cloud messaging web ui
What is Expected?
Push notification should come just once
What is actually happening?
Notification comes twice
I found this topic at stack overflow, but after 3 hours of tries and struggling nothing helped to solve this problem(