titaniumnetwork-dev / Ultraviolet-App

Example application of Ultraviolet which can be deployed in production.
https://docs.titaniumnetwork.org/proxies/ultraviolet
MIT License
291 stars 4.46k forks source link

Error registering service worker in new version #14

Closed Cryodev1 closed 1 year ago

Cryodev1 commented 1 year ago

Expected Behavior

Should be registering service worker to be used

Current Behavior

Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('http://localhost:8080//service/') with script ('http://localhost:8080/sw.js'): A bad HTTP response code (404) was received when fetching the script.

Steps to Reproduce

  1. Install latest
  2. npm install in directory
  3. npm start
  4. Open website
  5. Search anything

Possible Cause

I used an old version of uv on this computer so its possible some things aren't matching up because of things left by the old version

Cryodev1 commented 1 year ago

Update: Installing Ultraviolet-Static worked but now the error has changed to

SecurityError: Failed to register a ServiceWorker for scope ('http://localhost:8080/service/') with script ('http://localhost:8080/uv/sw.js'): The path of the provided scope ('/service/') is not under the max scope allowed ('/uv/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.

Along with

uv.sw.js:30 Uncaught TypeError: Class extends value undefined is not a constructor or null at uv.sw.js:30:43 at uv.sw.js:1:4641 at sw.js:10:1

e9x commented 1 year ago

SecurityError: Failed to register a ServiceWorker for scope ('http://localhost:8080/service/') with script ('http://localhost:8080/uv/sw.js'): The path of the provided scope ('/service/') is not under the max scope allowed ('/uv/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.

You will either need to move the UV scripts to the root of your static directory, or configure your config to run on /uv/service/.

uv.sw.js:30 Uncaught TypeError: Class extends value undefined is not a constructor or null at uv.sw.js:30:43 at uv.sw.js:1:4641 at sw.js:10:1

This is due to cache or you have not updated your uv.bundle.js.