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

Request scheme 'chrome-extension' is unsupported #66

Open
Siderite opened this issue Oct 2, 2019 · 13 comments
Open

Request scheme 'chrome-extension' is unsupported #66

Siderite opened this issue Oct 2, 2019 · 13 comments

Comments

@Siderite
Copy link

Siderite commented Oct 2, 2019

Uncaught (in promise) TypeError: Request scheme 'chrome-extension' is unsupported
at serviceworker:26

I get this error in the console from cache.put(request, copy). I don't see any way to fix it without downloading the source code and changing it.

@Siderite
Copy link
Author

Siderite commented Oct 15, 2019

The docs say that the Web cache API can only put http/https requests (https://developer.mozilla.org/en-US/docs/Web/API/Cache/put#Return_value). So this can be solved by adding a check in code like:

caches.open(version)
            .then(function (cache) {
                // here be the fix
                if (!/^https?:$/i.test(new URL(request.url).protocol)) return;
                cache.put(request, copy);
            });

used in CacheFingerprinted.js and CacheFirstSafe.js

@Darkace01
Copy link
Contributor

The docs say that the Web cache API can only put http/https requests (https://developer.mozilla.org/en-US/docs/Web/API/Cache/put#Return_value). So this can be solved by adding a check in code like:

caches.open(version)
            .then(function (cache) {
                // here be the fix
                if (!/^https?:$/i.test(new URL(request.url).protocol)) return;
                cache.put(request, copy);
            });

used in CacheFingerprinted.js and CacheFirstSafe.js

How do we add this to our code?

@Darkace01
Copy link
Contributor

I think I found a fix to it
caches.open(version) .then(function (cache) { // here be the fix if(request.url.match("^(http|https)://")){ cache.put(request, copy); }else{ return; }

@jolugama
Copy link

jolugama commented Jun 3, 2021

yes, it's works. Thanks

@kenneymyers
Copy link

I think I found a fix to it
caches.open(version) .then(function (cache) { // here be the fix if(request.url.match("^(http|https)://")){ cache.put(request, copy); }else{ return; }

How did you apply this fix? Is this something that can be merged into the nuget package so we can all benefit from the fix?

@Darkace01
Copy link
Contributor

I think I found a fix to it
caches.open(version) .then(function (cache) { // here be the fix if(request.url.match("^(http|https)://")){ cache.put(request, copy); }else{ return; }

How did you apply this fix? Is this something that can be merged into the nuget package so we can all benefit from the fix?

I added that in my service worker.js file

I don't know if it could be added to the nugget package

I can try to figure out a way to make a pull request to the repo to fix this

@kenneymyers
Copy link

I went ahead and pulled down the source and just fixed it in the CacheFirstSafe.js, CacheFirst.js, and NetworkFirst.js. It seems to work well. Thank you!

@Darkace01
Copy link
Contributor

I went ahead and pulled down the source and just fixed it in the CacheFirstSafe.js, CacheFirst.js, and NetworkFirst.js. It seems to work well. Thank you!

#84

Check out this pull request if it would help

@xbaha
Copy link

xbaha commented Nov 24, 2021

I got the same error, is this going to be merged in the next release?

@Darkace01
Copy link
Contributor

I think @madskristensen is working on the next release

@Darkace01
Copy link
Contributor

I got the same error, is this going to be merged in the next release?

Also I think you can just update your service worker directly before the release

@xbaha
Copy link

xbaha commented Nov 24, 2021

How do I update the service worker??

@Darkace01
Copy link
Contributor

you can create the service worker file but I think it is auto-created when you install the package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants