Create-react-app: Firefox 69+: Error unregistering serviceWorker

Created on 29 Nov 2019  路  19Comments  路  Source: facebook/create-react-app

When trying to run an application created with creat-react-app using Firefox 69+ I receive the following error:

Unhandled Rejection (SecurityError): The operation is insecure

Error unregistering serviceWorker

Tested with latest Chrome and Edge version -> OK
Tested with Firefox 67 -> OK

Most helpful comment

This exception is raised in Firefox when the Delete cookies and site data when Firefox is closed (in settings) is set.

'serviceWorker' in navigator is true but the navigator.serviceWorker.ready Promise rejects (at least on Firefox 72)

All 19 comments

8079 fixes this issue

If it's urgent for you then you'll have to apply the change directly in your project. Here is the fix.
https://github.com/facebook/create-react-app/pull/8079/files

@gamedev8 I don't think this issue is related to #8079. I am experiencing #8047 in production, not when running with webpack dev server.

@esetnik are you sure? I was also getting this "SecurityError The operation is insecure" error and the code in #8079 fixed it for me.

@gamedev8 you were getting the SecurityError The operation is insecure in production or when you run the project locally? I'm getting that security error when the project is in production which has nothing to do with the change in #8079.

@esetnik Ok there must be different issues happening. I was getting it locally in Firefox using https.

Same issue here. Latest Chrome and Safari are fine. Only latest Firefox complains. Development only:

Screen Shot 2019-12-07 at 1 45 33 PM

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

The issue is still present, please don't close it.

I experience the same issue. Only in Firefox, using http, in my dev environment. Registering the service worker makes the problem go away, but this is not a desirable solution.

I'm also experiencing this issue in Firefox 72.0.2 (64-bit) on Mac OS Mojave 10.14.6.

This exception is raised in Firefox when the Delete cookies and site data when Firefox is closed (in settings) is set.

'serviceWorker' in navigator is true but the navigator.serviceWorker.ready Promise rejects (at least on Firefox 72)

What's the reasoning for having service workers in the CRA template? I guess it's a good thing if you want offline support and what not, but is it really necessary as a default?

This exception is raised in Firefox when the Delete cookies and site data when Firefox is closed (in settings) is set.

'serviceWorker' in navigator is true but the navigator.serviceWorker.ready Promise rejects (at least on Firefox 72)

@lPadier - BOOM! That is it. I have Firefox setup the same way and was scratching my head!

I'm also seeing this on production with Firefox 73.0

I believe this was fixed in #8272 but you need to manually update your serviceWorker.js file to match the template for an existing project.

FWIW I'm seeing better handling in the latest version of serviceWorker.js. I'm going to try swapping mine out with the new code and see if that works.

I believe this was fixed in #8272 but you need to manually update your serviceWorker.js file to match the template for an existing project.

Ha yup I think that's probably it.

I think the default serviceWorker.js should be referenced from the react-scripts project instead of being part of the template with the capability to override the default. There's been a number of changes to the serviceWorker over time and it's a pain to have to manually keep it in sync.

Closing as it sounds like it's resolved in latest templates.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oltsa picture oltsa  路  3Comments

alleroux picture alleroux  路  3Comments

DaveLindberg picture DaveLindberg  路  3Comments

fson picture fson  路  3Comments

barcher picture barcher  路  3Comments