Skip to content
Advertisement

Uncaught (in promise) TypeError: Request failed

I am creating a Progressive Web App for a university project, but when I checked the console I have this error:

Uncaught (in promise) TypeError: Request failed – serviceworker.js:1

I don’t understand where this error is coming from.

The HTML and CSS are showing on as expected, but when I do a PWA audit from the Chrome Dev Tools, it’s showing these failures. They are ‘no service worker’, ‘no 200 when offline’ and ‘user not prompted to install web app’.

Any help is appreciated!

Thanks in advance!

JavaScript
JavaScript

JavaScript

Advertisement

Answer

Remove this line:

JavaScript

You’re not supposed to include your SW as a script in the page. You’re only supposed to interact with it by calling the navigator.serviceWorker.register() as you do in your script above.

Lighthouse is not reporting it but I’m making sure: you’re serving the website overt HTTPS right?

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement