WebApp: Failures: Service worker does not successfully serve the manifest's start_url

Alexander Tyapkov picture Alexander Tyapkov · Oct 26, 2017 · Viewed 8.2k times · Source

After testing the web app with Lighthouse I have such error:

User will not be prompted to Install the Web App Browsers can proactively prompt users to add your app to their homescreen, which can lead to higher engagement. Learn more.

Failures: Service worker does not successfully serve the manifest's start_url.

All the criteria described here are satisfied:

  1. The site is served over HTTPS.
  2. A service worker is registered.
  3. The scope of the service worker includes the page you audited and the page specified in the start_url property of the web app manifest.
  4. A web app manifest exists and meets the following criteria: Has a valid name property. Has a valid short_name property. Has a valid start_url property. Has a valid display property and the value is standalone, fullscreen, or minimal-ui. Specifies an icon that is at least 192px by 192px.

The manifest files is rendered via script. Important variables are

scope_url = 'https://website.com/app/'
start_url = 'https://website.com/app/about/'

ServiceWoker.js is quite simple:

self.addEventListener('push', function(e) {

  ...
});

self.addEventListener('notificationclick', function (e) {
    ...
);

Web App and sw.js are served from start_url.

What else can I check?

Edit 1. When I try to "Add to homescreen" from Chrome console I get:

Site cannot be installed: the page does not work offline what is close to this comment

Answer

Alexander Tyapkov picture Alexander Tyapkov · Oct 26, 2017

After changing start_url to 'https://website.com/app/' and adding:

self.addEventListener('fetch', function(e){

});

to serviceWorker.js the problem has been solved.