Operation is not implemented, or supported, or enabled

225 views
Skip to first unread message

Nirajan Maharjan

unread,
Sep 11, 2024, 5:57:10 PMSep 11
to Firebase Google Group
I am using electron to wrap my react app. 

In my react app, i have set up the firebase properly and it is workig fine. 

Now since I need this to work on my electron app, I have added  a package to receive push notification named `electron-push-receiver` which receives the notification and handles accordingly.

This all seemd to work fine. But all of sudden, as per my memory, this stopped working without making any changes on my react app, which throws error like:

notification error 501
which has the following response as:
```{  "error": {    "code": 501,    "message": "Operation is not implemented, or supported, or enabled.",    "status": "UNIMPLEMENTED"  }}``` 

The code that had generated this error seems to be:

 <script>
    try {
      const { ipcRenderer } = require('electron');
      const remote = require('electron').remote;
      const {
        START_NOTIFICATION_SERVICE,
        NOTIFICATION_SERVICE_STARTED,
        NOTIFICATION_SERVICE_ERROR,
        NOTIFICATION_RECEIVED,
        TOKEN_UPDATED,
      } = window.require('electron-push-receiver/src/constants');
      window.showWindowAlarm = remote?.getGlobal('global').showWindowAlarm;

      // Ensure window.Notifications is defined
      if (!window.Notifications) {
        window.Notifications = {};
      }

      // Ensure notificationToken and payloadReceived are defined
      if (!window.Notifications.notificationToken) {
        window.Notifications.notificationToken = { value: null };
      }

      if (!window.Notifications.payloadReceived) {
        window.Notifications.payloadReceived = function (payload) {
        };
      }

      // Listen for service successfully started
      ipcRenderer.on(NOTIFICATION_SERVICE_STARTED, (_, token) => {
        if (window.Notifications && window.Notifications.notificationToken) {
          window.Notifications.notificationToken.value = token;
        }
      });

      // Handle notification errors
      ipcRenderer.on(NOTIFICATION_SERVICE_ERROR, (_, error) => {
        console.error('notification error', error);
      });

      // Send FCM token to backend
      ipcRenderer.on(TOKEN_UPDATED, (_, token) => {
        if (window.Notifications && window.Notifications.notificationToken) {
          window.Notifications.notificationToken.value = token;
        }
      });

      // Display notification

      ipcRenderer.on(
        NOTIFICATION_RECEIVED,
        async (_, serverNotificationPayload) => {

        }
      );

      // Start service
   
      ipcRenderer.send(START_NOTIFICATION_SERVICE, senderId);

      window.usingElectron = true;
    } catch (e) {
      console.log(
        `Probably not using Electron - got error ${e} trying to set up using Electron Push.`
      );
    }
  </script>

this above code is in my reactjs index.html file.

I am unable to solve this issue. 

FYI: I had another same configuration which was working fine and recently it is also receiving same error.

Thanks,
Nirajan

Joe Spiro

unread,
Sep 11, 2024, 5:59:15 PMSep 11
to Firebase Google Group
It appears that electron-push-receiver uses deprecated (and soon disabled) APIs. This is an issue with the plugin. Please file an issue with them and consider redirecting to the correct API in a forked version of the code in the meantime.

Regards,
Joe
Reply all
Reply to author
Forward
0 new messages