Unhandled Rejection (SecurityError): The operation is insecure. On a fresh create-react-app project Unhandled Rejection (SecurityError): The operation is insecure. On a fresh create-react-app project reactjs reactjs

Unhandled Rejection (SecurityError): The operation is insecure. On a fresh create-react-app project


This problem seems to only happen in Firefox. Edge worked fine.

After creating the project, in index.js change:

serviceWorker.register();//serviceWorker.unregister();

Still trying to figure whose fault this is, but this should get you going.


Another solution found in the link in the answer by Niraj Niroula:

If you want to keep the Delete cookies and site data when Firefox is closed option enabled, click on the Manage Exceptions button and add localhost (with the protocol and port) to the exceptions list:

cookie and site data deletion exceptions


Seems that the issue exists only in Firefox. Anyone still bugged by this bug can try disabling Delete cookies and site data when Firefox is closed option in Privacy and Security settings.enter image description hereOr try wrapping the navigator.serviceWorker usages inside a try/catch. In my case

  if ("serviceWorker" in navigator) {    navigator.serviceWorker.ready      .then(registration => {        registration.unregister();      })      .catch(error => console.log("ServiceWorker Warning: ", error));  }

For related discussion and more info