Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

[Bug]: pwabuilder-sw.js not served from storage provider #7722

Closed
barankyle opened this issue Mar 10, 2023 · 0 comments · Fixed by #7767
Closed

[Bug]: pwabuilder-sw.js not served from storage provider #7722

barankyle opened this issue Mar 10, 2023 · 0 comments · Fixed by #7767
Assignees

Comments

@barankyle
Copy link
Member

If the client is built to be served from the storage provider, the file pwabuilder-sw.js is still being served from the original app domain. e.g., despite everything else coming from resources.ethereralengine.com, that file is still looked for at app.etherealengine.com. The file can still be obtained from there, but via a 304, which some browsers do not accept, since they strictly expect a script file, while the 304 comes back as text/html, and is rejected.

The route can be specified in index.html:

if ("serviceWorker" in navigator) {
      if (navigator.serviceWorker.controller) {
        console.log("[PWA Builder] active service worker found, no need to register");
      } else {
        // Register the service worker
        navigator.serviceWorker
          .register("pwabuilder-sw.js", {
            scope: "./"
          })
          .then(function (reg) {
            console.log("[PWA Builder] Service worker has been registered for scope: " + reg.scope);
          });
      }
}

https://stackoverflow.com/questions/56885426/using-pwa-builder-from-microsoft-uncaught-in-promise-typeerror-request-faile

@barankyle barankyle self-assigned this Mar 10, 2023
@barankyle barankyle linked a pull request Mar 17, 2023 that will close this issue
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant