Service worker script errors if run in chrome extension
See original GitHub issueIs this a bug report?
Bug
Can you also reproduce the problem with npm 4.x?
Unrelated
Which terms did you search for in User Guide?
chrome
Environment
node -v
: 8.5.0npm -v
: 5.4.0yarn --version
(if you use Yarn):npm ls react-scripts
(if you haven’t ejected): 1.0.13
Then, specify:
- Operating system: Ubuntu 16.04
- Browser and version (if relevant): Chrome 61
Steps to Reproduce
- Run compiled app as chrome extension
Expected Behavior
- No errors in console
Actual Behavior
Uncaught (in promise) TypeError: Request scheme 'chrome-extension' is unsupported
at service-worker.js:1
at <anonymous>
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Service worker registration failed. Chrome extension
If the worker script throws an error at installation, the worker won't be registered and you will not be getting the error information...
Read more >Manifest V3 service worker registration failed
When I try to load the extension it loads fine but there's an error logged under the Errors section "Service worker registration failed"...
Read more >Chrome Extensions: Manage events with service workers
Extensions monitor these events using scripts in their background service worker, which then react with specified instructions.
Read more >Service Worker in Browser Extensions
A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features...
Read more >Advanced chrome extension development
Background service worker · It runs in the context of the whole chrome browser. · Background script has only one instance. · There...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is what I’d expect if you attempt to register a service worker that intercepts requests for
chrome-extension:
URLs. The service worker can’t respond to to those types of requests, and there’s an error logged suggesting as much.Chrome has its own approach to installing/caching the resources needed to display a Chrome Extension. Service workers don’t fit into that picture.
The message in the console can be safely ignored (it’s not going to affect your extension’s functionality), and to prevent it from showing up in the future, you can modify your
index.js
to remove theregisterServiceWorker()
call.There’s also an
unregister
function that you could optionally add in to yourindex.js
if you’ve deployed this publicly and want to “clean up” the noise from the previous non-functionality registration.