Capacitor PushNotifications does not have web implementation

Hello,
it’s my first time trying to use capacitor.
I am using quasar with capacitor. And i’m trying to get PushNotifications running.

I always get:
Uncaught (in promise) PushNotifications does not have web implementation.

Code ( app.vue ):

mounted() {
    if (process.env.MODE == "capacitor") {
      const { Plugins} = require("@capacitor/core");
      const { PushNotifications } = Plugins;
      console.log(Object.keys(Plugins));
   
      PushNotifications.requestPermission().then( result => {
      if (result.granted) {
        PushNotifications.register();
      }
   }
}

Anyone knows what this is? Im am not running in Web mode…
Object.keys(Plugins) does not include PushNotifications :frowning:

Do i have to enable PushNotifications anywhere?!

I tested via android studio emulator and on a samsung tablet.

Installed Dependencies:
  @capacitor/ios not installed
  @capacitor/cli 2.4.4
  @capacitor/android 2.4.4
  @capacitor/core 2.4.4
  @capacitor/electron not installed

[success] Android looking great! 👌

Regards
Nico

I now found out, that the error only occours, when the devserver is running on https…

@NicoP-S by any super chance did you happen to write a unit test for the PushNotifications.requestPermission() call?

How does one mock such call for your code above?

@github4es no i did Not write any unit test for this sorry.

Solved my Problem with using webpack dev Server without https enabled. That was fine for me

1 Like