Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "Uncaught add-to-cache-list-unexpected-type" and "Uncaught (in promise) TypeError: Failed to register a ServiceWorker for Scope..." #270

Closed
Andrijaaa98 opened this issue Apr 3, 2020 · 7 comments · Fixed by #271
Labels
bug Something isn't working service-workers
Milestone

Comments

@Andrijaaa98
Copy link

Hello,

I'm getting createCacheKey.js:35 Uncaught add-to-cache-list-unexpected-type: add-to-cache-list-unexpected-type :: [{"entry":{"url":"","revision":null}}] error on my site and can't find the problem.

Also getting (index):1 Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('https://jobs.buttinette.com/') with script ('https://jobs.buttinette.com/?wp_service_worker=1'): ServiceWorker script evaluation failed.

I'm using Avada theme and they recommend using your plugin hence everything should be working after installing and activating your plugin, but yesterday after updating Wordpress version and Avada version I started getting those two errors.

I don't know if those two errors are connected or not, but could you help me get to the root of the problem and fix it?

Thank you.

@westonruter
Copy link
Collaborator

Thanks for the report. I'm seeing that too.

In your service worker, I'm seeing these precache entries:

wp.serviceWorker.precaching.precache([
    {
        "url": "https://jobs.buttinette.com/wp-content/uploads/2020/04/buttinette_app-66x66.png",
        "revision": "2020-04-01 15:07:49"
    },
    {
        "url": "https://jobs.buttinette.com/wp-content/uploads/2020/04/buttinette_app-200x200.png",
        "revision": "2020-04-01 15:07:49"
    },
    {
        "url": "https://jobs.buttinette.com/wp-content/uploads/2020/04/buttinette_app-300x300.png",
        "revision": "2020-04-01 15:07:49"
    },
    {
        "url": "",
        "revision": null
    },
    {
        "url": "https://jobs.buttinette.com/?wp_error_template=offline",
        "revision": "0.4.0;Avada=6.2.2;user=0;options=0e5eff12818a2954ab2fd3707c78d4a1;nav=3cf536032a0c24659b9268e925ec5b18;deps=a007b92e9fb81ea3c157341992bbbc9e;c712438d74f6978c973b74277c32e3da"
    },
    {
        "url": "https://jobs.buttinette.com/?wp_error_template=500",
        "revision": "0.4.0;Avada=6.2.2;user=0;options=0e5eff12818a2954ab2fd3707c78d4a1;nav=3cf536032a0c24659b9268e925ec5b18;deps=a007b92e9fb81ea3c157341992bbbc9e;eb2b151a961c66973364923e8dc8cd35"
    }
]);

Note the empty url. That's causing the problem. My guess is that Avada is registering trying to precache something incorrectly. The PWA plugin should be updated to automatically omit such entries, but the quickest fix may be for you to look at how Avada is gathering URLs for precaching.

@westonruter
Copy link
Collaborator

@Andrijaaa98 In addition to the need to identify why Avada is attempting to precache an empty URL, I've opened #271 which will prevent your service from failing to install. Please give it a try.

@Andrijaaa98
Copy link
Author

@westonruter Hi Weston, thank you very much for fast reply and even faster fix. Errors are gone and there are no empty url's so that's great. But I'm getting another error:

(index):1302 GET https://jobs.buttinette.com/wp-content/uploads/fusion-gfonts/KFOmCnqEu92Fr1Mu4mxMKTU1Kg.woff net::ERR_ABORTED 404 (Not Found)

which might be connected, I'm not sure. Also I'm getting info message:

fetchWrapper.js:98 Fetch failed loading: GET "https://jobs.buttinette.com/wp-content/uploads/fusion-gfonts/KFOmCnqEu92Fr1Mu4mxMKTU1Kg.woff"..

Error leads to index.php page at line 1302 where </div></script><!--googleon: all--> <script> is typed and info message leads to fetchWrapper.js at line 98 where fetchResponse = await fetch(request, fetchOptions); is typed. Do you think those problems are connected?

@westonruter
Copy link
Collaborator

That doesn't seem related. The service worker is installing just fine. When it is attempting to fetch a URL it is reporting an (expected) error because it is not found. The CSS on the page has code like this:

@font-face {
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: local('Roboto Italic'), local('Roboto-Italic'), url(https://jobs.buttinette.com/wp-content/uploads/fusion-gfonts/KFOkCnqEu92Fr1Mu51xFIzQXKMnyrYk.woff) format('woff');
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

The URL https://jobs.buttinette.com/wp-content/uploads/fusion-gfonts/KFOkCnqEu92Fr1Mu51xFIzQXKMnyrYk.woff is 404'ing.

@Andrijaaa98
Copy link
Author

URL is 404'ing because /fusion-gfonts folder doesn't exist.

@westonruter
Copy link
Collaborator

That would be a problem with your site generally, not with the PWA plugin.

@Andrijaaa98
Copy link
Author

Okay, I thought that PWA plugin could get wrong directory or is set for a "standard" directory. All in all, thank you very much.

@westonruter westonruter added this to the 0.5 milestone May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working service-workers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants