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 not defined while accessing PWA in development

See original GitHub issue

As first reported in a PR by @cuining, this regression seems to be introduced in the move away from Parcel.

I believe this may be addressed in #3833, but some more information is still needed.

OS/Web Information

  • Web Browser: Chrome
  • Local OS: macOS
  • Remote OS: macOS
  • Remote Architecture: 64 bit
  • code-server --version: 3.11.0

Steps to Reproduce

  1. Start code-server via yarn watch
  2. Open in Chrome, add a PWA shortcut
  3. Refresh

Expected

No console errors should occur.

Actual

Service worker registration fails due to an invalid path. However, the file is available at an different path.

Screenshot

Screen Shot 2021-07-21 at 14 40 39

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
code-ashercommented, Jul 22, 2021

Ack we didn’t update this path!

https://github.com/cdr/code-server/blob/7b8cd25c0c48b6a1799587ebbc9b09d6af7988f3/src/browser/register.ts#L8

We probably didn’t notice during development because we had the old Parcel dist directory from previous builds.

2reactions
code-ashercommented, Jul 22, 2021

Looks like we should re-open that PR as it has the right fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Service Workers - Web APIs | MDN
Service workers fix these issues. Using a service worker you can set an app up to use cached assets first, thus providing a...
Read more >
reference error in PWA serviceworker · Issue #7372 · go-gitea ...
UPD: that Firefox has dom.caches.enabled set to false , so the caches var is not defined on serviceworker registration.
Read more >
Why is Service worker not working in Chrome? - Stack Overflow
In short: Service workers requires the site using them to be served over HTTPS for security reasons, but have execptions for localhost.
Read more >
Service workers - web.dev
Before a service worker takes control of your page, it must be registered for your PWA. That means the first time a user...
Read more >
Step 2 : Install a Service Worker - PWA Workshop
This means that the Service Worker has been registered. This can be verified by looking in the Application tab of Chrome Dev Tools,...
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