Home › Forums › WPLMS Live › WPLMS Push Notifications › push notification NOK, console error "Error during service worker registration"
- This topic has 24 replies, 2 voices, and was last updated 5 years, 1 month ago by Anshuman Sahu.
-
AuthorPosts
-
August 28, 2019 at 2:07 am #223822hanineSpectatorAny update please?August 28, 2019 at 3:04 pm #223925Anshuman SahuKeymasterYEs 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 /September 28, 2019 at 7:17 pm #228139hanineSpectatorHi 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.October 1, 2019 at 8:14 am #228353Anshuman SahuKeymasterHi 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 ?October 3, 2019 at 6:53 pm #228713hanineSpectatorHi 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"})October 4, 2019 at 2:39 pm #228876Anshuman SahuKeymasterWe 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 .October 4, 2019 at 3:37 pm #228892hanineSpectatorThis reply has been marked as private.October 7, 2019 at 12:55 pm #229128Anshuman SahuKeymasterHi thanks for the plugin , I will try it out.October 9, 2019 at 2:02 pm #229407hanineSpectatorHi Alex, We have checked the plugin we uploaded, and the change is actually only in the front-end js file. Have a good dayOctober 11, 2019 at 1:53 pm #229783Anshuman SahuKeymasterUsed your plugin but it did not work on our server .Im sure it is related to server .
-
AuthorPosts
- The topic ‘push notification NOK, console error "Error during service worker registration"’ is closed to new replies.