MatthieuLemoine / electron-push-receiver

A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
194 stars 64 forks source link

Electron 4 support #41

Closed DreamitMauri closed 5 years ago

DreamitMauri commented 5 years ago

Since upgrading to Electron 4.0.1 from Electron 2.0.14 I receive these errors:

npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! kodinportti@1.0.8 electron:serve: `wait-on http-get://localhost:4200/ && npm run electron:serve-tsc && electron . --serve`
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the app@1.0.8 electron:serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-01-10T13_12_27_228Z-debug.log
ERROR: "electron:serve" exited with 3221225477.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app@1.0.8 start: `npm run postinstall:electron && npm-run-all -p ng:serve electron:serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app@1.0.8 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-01-10T13_12_27_396Z-debug.log

Here's my code:

    import { setup as setupPushReceiver } from 'electron-push-receiver';

    // Create the browser window.
    browserWindow = new BrowserWindow({
        x: 0,
        y: 0,
        width,
        height,
        frame: serve,
        backgroundColor: '#333333',
        icon: `${__dirname}/src/assets/icons/icon.png`,
        webPreferences: {
            // disable CORS
            webSecurity: false
        }
    });

    // Set up push notification receiver
    try {
        setupPushReceiver(browserWindow.webContents);
    } catch (e) {
        logError(e);
    }

There is no exception from setupPushReceiver, the app just crashes.

Also tested with Electron 3.1.0. Same issue.

DreamitMauri commented 5 years ago

I've done some more digging on this.

I believe the issue is with push-receiver (https://github.com/MatthieuLemoine/push-receiver) and not this package. I have created an issue there: https://github.com/MatthieuLemoine/push-receiver/issues/23