11
votes

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

2
We still need a good answer for this. Been beating my head trying to figure out why this happens. Alex, have you learned anything more since your post?karns
@karns not actually, after changing start_url and adding fetch everything is working as expected.Alexander Tyapkov
Alex, so couple things: 1) You are indeed using aboslute URL for start_url? Wondering if maybe using relative URL is my problem - wouldn't think so. 2) Does the error come back if you remove one of your apps dependencies? IE. removing Angular Core for an Angular app. Trying to narrow this issue down! Thankskarns
Also, wondering if you try using relative path if the error comes back..karns
@karns I cannot test because I have a working configuration. However, I have interesting observation - after testing the pwa app with lighthouse I again got the same error. At the same time, in mobile browser the promt to install the app is shown as expected.Alexander Tyapkov

2 Answers

5
votes

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

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

});

to serviceWorker.js the problem has been solved.

0
votes

It seems that a recent version of chrome-devtools-lighthouse verifies that the your start_url is served successfully (some content and response code 200 is returned) even while the device is offline.