Google chrome Google推送通知-DomeException:注册失败-推送服务错误

Google chrome Google推送通知-DomeException:注册失败-推送服务错误,google-chrome,push-notification,firebase-cloud-messaging,Google Chrome,Push Notification,Firebase Cloud Messaging,我正在尝试使用无趣的键在我的网站上启用推送通知。 当我包含gcm_sender_id并从pushManager.subscribe方法中删除applicationServerKey时,它运行良好 仅当我启用VAPID键并从manifest.json文件中删除gcm_sender_id时。我得到了下面的错误 DOMException: Registration failed - push service error 我使用的是Chrome浏览器。我在pushManager.subscribe方法

我正在尝试使用无趣的键在我的网站上启用推送通知。 当我包含gcm_sender_id并从pushManager.subscribe方法中删除applicationServerKey时,它运行良好

仅当我启用VAPID键并从manifest.json文件中删除gcm_sender_id时。我得到了下面的错误

DOMException: Registration failed - push service error

我使用的是Chrome浏览器。

我在pushManager.subscribe方法中使用的applicationServerKey不正确。 当我使用下面的模块重新生成节点中的键时,它工作了

const webpush = require('web-push');
const vapidKeys = webpush.generateVAPIDKeys()

我明白了,但这只是一个开始Brave@Anthony勇敢的解决方案: