question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Service worker script errors if run in chrome extension

See original GitHub issue

Is 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

  1. node -v: 8.5.0
  2. npm -v: 5.4.0
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected): 1.0.13

Then, specify:

  1. Operating system: Ubuntu 16.04
  2. 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:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
jeffposnickcommented, Sep 18, 2017

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 the registerServiceWorker() call.

There’s also an unregister function that you could optionally add in to your index.js if you’ve deployed this publicly and want to “clean up” the noise from the previous non-functionality registration.

0reactions
jeffposnickcommented, Dec 21, 2017
// Inside index.js:
import {unregister} from './registerServiceWorker';
unregister();
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found