Failed Audits: Myntra and Flipkart
URL's: https://www.flipkart.com, https://www.myntra.com
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3256.0 Safari/537.36
Issue: Failed Audits:
- Does not respond with a 200 when offline
- User will not be prompted to install the web app
Observations:
- Both Flipkart and Myntra register a service worker and respond with 200 when offline. They are caching the start URL's specified in the manifest file


- Both have separate service workers for desktop web app. There can be a possibility that Lighthouse is auditing based on desktop service worker.
It seems like flipkart's site when loaded under Lighthouse does not create the same caches as when visiting the site normally. I'm not familiar with the site's code to understand what branches it may take to decide when not to cache the assets for offline but can confirm the exact same user agent and throttling settings were used.
Cache when loaded by LH (broken)

Cache when loaded normally (working)

Myntra has a similar $$$toolbox cache issue.
@gauntface ever seen something like this?
I checked this with @paulirish yesterday on Flipkart. It didn't suffer from the two reported issues that @kgaurav7 posted. Just tried running this again and got the failure to response to 200 and I could actually reproduce outside of lighthouse after it's run.
Looking a little more - seems like I get a tonne of extra caches made when loading up the mobile view which is branded "Flipkart Lite". The desktop viewport seems to cache very little.
I'm not sure how Lighthouse is doing it's tests for this, but if it runs in and out of mobile views, it may get different results for this audit.
@patrickhulce the caches loaded in the first instance are those created by the desktop SW while the latter are by the mobile SW. @gauntface the two SWs have different caches and the mobile site does cache a bit aggressively.
To be honest, we've had a hard time with this bug. We don't know exactly what's going on.
We're likely not going to be able to dig into this within the next 2 months, but we'd like to fix it within the next few quarters.
One thing to note in other tests - if the manifest isn't in the pre-cache list, then chrome will fail to load the manifest, meaning it can't find the start URL and results in a failed attempt to load the page offline (or at least that is what others are reporting).
Hi, adding to the thread, a similar problem that I am facing. I am implementing a service worker using workbox, and I've precached my offline page, manifest.json and start_url of manifest.json. While the offline page is served fine, both in case of start_url of manifest.json and for entry level url, the lighthouse audit fails the start_url does not respond 200 when offline .
The service worker code for offline handling :
workbox.routing.registerRoute(/\/\?utm_source=homescreen$/, async ({ event }) => {
try {
return await workbox.strategies.networkOnly().handle({ event });
} catch (error) {
return caches.match('/offline.html');
}
});
workbox.routing.registerRoute(/\/$/, async ({ event }) => {
try {
return await workbox.strategies.networkOnly().handle({ event });
} catch (error) {
console.log('serving offline');
return caches.match('/offline.html');
}
});
Also, different lighthouse versions, show different errors for the same failed audit.
Attaching screen shots for the same. Also, note that the offline page is just a static html file.
(Offline page served from cache, when user goes offline from Network tab )
(Lighthouse audit fail, when done through inbuilt lighthouse in Chrome)
(Lighthouse audit fail when done through extension, version : 4.2.0)
(Precaching the aforementioned assets through workbox)
@kanishk-anand-oyo Lighthouse is failing because it can't find your web app manifest, not necessarily because your page doesn't work offline. Are you sure you're referencing a valid manifest from your page? Do you have a public URL for us?
This is an old old issue from when we fetched the manifest pretty differently, so I'd guess it's a different issue than you're seeing @kanishk-anand-oyo. I'm going to close, but if others feel like it is still and issue or have an update, we can always reopen.