push notification NOK, console error "Error during service worker registration"

Home Forums WPLMS Live WPLMS Push Notifications push notification NOK, console error "Error during service worker registration"

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • #223822
    hanine
    Spectator
    Any update please?
    #223925
    Anshuman Sahu
    Keymaster
    YEs we have tried some solutions for this but they are not working .We are still researching on it why its not working . It works on my localhost . But not on the servers /
    #228139
    hanine
    Spectator
    Hi Alex, We could finally found where the issue came from and corrected it, and now the push notifications are working correctly. First, the issue has no relation to https or http protocol and connection to firebase, it's just a mistake in a file name. During the register operation, the plugin was trying to register the service file "service-worker.js" and this is what caused the error. When we used ad-dons to check the existing services, we found that for the site https://comfortzomeheroes.com/ the service file name was "firebase-messaging-sw.js" instead of "servie-worker.js". Digging further in the code after we unminified it (there was only minimized js files in the plugin which made the worker more difficult), we found that the file created for the service is "firebase-messaging-sw.js", so we changed the name of the file to register, and now it woks with no issue. It would be great if you can include in the plugin the 3 js files unminified, and call the ones minimized in the script calls, this will give us more room as clients for testing purposes and debugging in case of issues.
    #228353
    Anshuman Sahu
    Keymaster
    Hi thanks for providing the solution . But we followed the same by copying the firebase-messaging-sw.js and putting the service-worker.js file in the root of the website  . Could you please share some more details on this exactly what change you made in the code ?
    #228713
    hanine
    Spectator
    Hi Alex, You don't need to make any copy of files, firebase-messaging-sw.js is created in the initial loading of the plugin and will be the one to use by plugin. All you need to do is inside the script files (the 3 js files in "\wp-content\plugins\wplms-push-notifications\assets\js\" change in the function that registers the script the name of the file to register from "/service-worker.js" to "/firebase-messaging-sw.js". change this content belwo by the one below it: navigator.serviceWorker.register("/service-worker.js",{scope:"/firebase-cloud-messaging-push-scope"}) navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})
    #228876
    Anshuman Sahu
    Keymaster
    We tried the same solution but it did not worked for us . We would need to debug more on this . Thanks for all your help suggesting the solution and debugging the issue on your own .
    #228892
    hanine
    Spectator
    This reply has been marked as private.
    #229128
    Anshuman Sahu
    Keymaster
    Hi thanks for the plugin , I will try it out.
    #229407
    hanine
    Spectator
    Hi Alex, We have checked the plugin we uploaded, and the change is actually only in the front-end js file. Have a good day
    #229783
    Anshuman Sahu
    Keymaster
    Used your plugin but it did not work on our server .Im sure it is related to server .  
Viewing 10 posts - 16 through 25 (of 25 total)
  • The topic ‘push notification NOK, console error "Error during service worker registration"’ is closed to new replies.