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

后端 未结 5 2377
孤街浪徒
孤街浪徒 2021-02-19 15:26

I created a new project with create-react-app then ran npm start then this showed up. https://imgur.com/a/3By9NCr

Using FF 69.0.3

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-19 15:48

    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. Or 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

提交回复
热议问题