Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Couldn't serve response for x from cache; Error, the cache is empty #103

Closed
aeharding opened this issue Apr 19, 2016 · 3 comments · Fixed by #105
Closed

Couldn't serve response for x from cache; Error, the cache is empty #103

aeharding opened this issue Apr 19, 2016 · 3 comments · Fixed by #105
Labels

Comments

@aeharding
Copy link

So I am having inconsistent issues getting this to actually cache anything. Some weeks it works, some it doesn't. Some weeks it works it chrome but not firefox, some weeks it doesn't.

I'm trying really hard to debug this, but I am failing.

Here's the error:
image

And the worker:
image

Here's the angular service where it's registered:
https://github.com/aeharding/financier/blob/master/src/scripts/services/offline.js

And here's the gulpfile:
https://github.com/aeharding/financier/blob/master/gulpfile.js#L143

Lastly, here's the site:
https://staging.financier.io

Any help is appreciated. I've tried everything I can think of. Sorry I couldn't narrow it down further.

@jeffposnick
Copy link
Contributor

I've noticed that too on rare occasions, and I believe it's due to refreshing/quitting the browser in the middle of the install event handler, leading to the properly named cache being created but not populated. Right now we cheat a little bit in the install handler and just check to see whether a cache with the appropriate name exists, without checking to see whether it's empty or not, but that should be changed to check the contents and work around this issue.

@jeffposnick jeffposnick self-assigned this Apr 20, 2016
@jeffposnick
Copy link
Contributor

(And FWIW, whenever you want to start fresh with a service worker during testing, I recommend using Chrome Incognito windows. You can verify in a new Incognito window that everything gets added to the cache properly there.)

@aeharding
Copy link
Author

aeharding commented Apr 20, 2016

Thanks, @jeffposnick. That works.

For anyone else:
Settings > Content settings > All cookies and site data... > Remove your site from the list

Then open your site, and don't immediately close/refresh. ;)

I guess I didn't bother doing this in the first place since I pressed the trash icon on the service worker in dev tools and expected that to do the same thing.

I'm looking forward to a fix for this edge case!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants