nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.38k stars 3.88k forks source link

Push notifications not working on windows #8218

Closed zkrige closed 1 month ago

zkrige commented 1 month ago

Issue Type

on 0.91.0 notifications work on macOS, but on windows I get AbortError: Registration failed - push service not available when fetching fcm token

/* global Config */
import 'https://www.gstatic.com/firebasejs/10.13.2/firebase-app-compat.js';
import 'https://www.gstatic.com/firebasejs/10.13.2/firebase-messaging-compat.js';

const firebaseApp = firebase.initializeApp(Config.firebaseConfig);

const messaging = firebase.messaging();

// Define your firebase object with namespaced methods
const fb = {
    firebaseApp,                // Firebase App instance
    onMessage: messaging.onMessage.bind(messaging),  
    getToken: messaging.getToken.bind(messaging),  
    messaging,                                  
    config: Config.firebaseConfig                 
};

window.fb = fb;
export default fb;

then in my app

 const token = await fb.getToken({
            vapidKey: ConfigService.firebase.vapidKey
        });

I get the error but only on windows

I run the app with chromeargs --enable-features=NativeNotifications --enable-gcm

I notice electron has a workaround using this package https://github.com/MatthieuLemoine/electron-push-receiver - Is something similar available for nw.js?

zkrige commented 1 month ago

this might be relevant

[3728:4516:0920/111928.819:WARNING:push_messaging_service_factory.cc(30)] PushMessagingService could not be built because InstanceID is unexpectedly disabled

zkrige commented 1 month ago

closing because the real issue is #8219