Reputation: 720
I am trying to enable push notifications on my website using VAPID keys. When i include the gcm_sender_id and remove the applicationServerKey from the pushManager.subscribe method, it runs fine.
Only when i enable VAPID keys and remove the gcm_sender_id from manifest.json file. i get the foloowing error.
DOMException: Registration failed - push service error
I am using Chrome browser.
Upvotes: 22
Views: 19021
Reputation: 3998
In my case,I was trying to run firebase messaging on a flutter web. My Browser was BRAVE.
It always failed with an exception of firebase fcm registration push servic error
.
I followed @Nicodemuz answer, but it didn't solve the issue. I get the same error.
The only solution was setting Google chrome as my executable.
Anyhow the issue is not with firebase or flutter, it's with the brave browser itself.
Upvotes: 4
Reputation: 4104
I encountered this error in Brave browser. By default, Google Services for push messaging are disabled in Brave. To enable this, open the following URL in brave:
brave://settings/privacy
After this, enable the flag "Use Google services for push messaging":
Source: https://github.com/firebase/firebase-js-sdk/issues/3195#issuecomment-848036637
Upvotes: 94
Reputation: 720
The applicationServerKey that i was using in the pushManager.subscribe method was somehow incorrect. It worked when i regenerated the keys in node using the following module.
const webpush = require('web-push');
const vapidKeys = webpush.generateVAPIDKeys()
Upvotes: 2