gdg-x / hoverboard

Conference website template
https://hoverboard-master.web.app
Other
1.1k stars 1.08k forks source link

Service worker redirect incorrect. #149

Closed friedger closed 7 years ago

friedger commented 7 years ago

I see an issue with service work on firefox at e.g. at https://devfest.be and https://devfest.gdg.org.ua/

It says something like "A service worker has handed over a "redirect" response to a FetchEvent.respondWith() although the RedirectMode was not 'follow'. Any ideas what is wrong? I have updated to v1.0.3.

To reproduce open the site in Firefox, then press refresh (F5 only).

friedger commented 7 years ago

Is this related to https://github.com/w3c/ServiceWorker/issues/737?

ozasadnyy commented 7 years ago

We are going to investigate this issue. Thanks, @friedger !

MrCsabaToth commented 7 years ago

How is your PWA hosted?

friedger commented 7 years ago

On firebase https://devfest-belgium.firebaseapp.com/

Le 3 oct. 2016 20:35, "Csaba Toth" notifications@github.com a écrit :

How is your PWA hosted?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gdg-x/hoverboard/issues/149#issuecomment-251187927, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYcWfm5LaK-FWlinbESap7AIWx__L1aks5qwUsOgaJpZM4KMHsp .

MrCsabaToth commented 7 years ago

develop or master branch? (I'm not sure if it matters)

friedger commented 7 years ago

It is develop. Or cheery picked from there.

Source at github.com/BruGTUG/DevFest2016

Le 3 oct. 2016 22:49, "Csaba Toth" notifications@github.com a écrit :

develop or master branch? (I'm not sure if it matters)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gdg-x/hoverboard/issues/149#issuecomment-251222604, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYcWe0AuG_K0HaFpDooK2VP056BWxcVks5qwWpfgaJpZM4KMHsp .

ozasadnyy commented 7 years ago

@friedger Have you made any changes to the code? I don't understand why I see this page: devfest belgium 2016 2016-10-12 00-30-17

Is it hosted on Firebase hosting?

friedger commented 7 years ago

Yes, I made this change as a workaround as I think the app shell needs more work.

It is on firebase: devfest-belgium.firebaseapp.com

I don't see the SyntaxError, confusing.

[image: --] Friedger Müffke [image: http://]about.me/friedger http://about.me/friedger

2016-10-11 23:32 GMT+02:00 Oleh Zasadnyy notifications@github.com:

@friedger https://github.com/friedger Have you made any changes to the code? I don't understand why I see this page: [image: devfest belgium 2016 2016-10-12 00-30-17] https://cloud.githubusercontent.com/assets/2954281/19289401/4dab7268-9013-11e6-8d09-2d5aa95e849e.png

Is it hosted on Firebase hosting?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gdg-x/hoverboard/issues/149#issuecomment-253053232, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYcWdQJKEICfPMutTjPyUXDJx8SSCbhks5qzAB-gaJpZM4KMHsp .

ozasadnyy commented 7 years ago

I have got it after a refresh on Firefox (MacOS). DevFest Ukraine website works ok. I recommend you to use the original solution. Btw, I can't reproduce original issue. Could you send me more details?

friedger commented 7 years ago

I am seeing the origin issue also with the DevFest Ukrain website. (Firefox on Windows):

Fehler beim Laden von 'https://devfest.gdg.org.ua/'. Ein ServiceWorker hat eine "redirect"-Antwort (Response) an FetchEvent.respondWith() übergeben, obwohl der RedirectMode nicht 'follow' war.service-worker.js:234:6

dbs commented 7 years ago

We've been suffering from this as well, and we're also hosted on Firebase. I just merged & deployed the latest master from hoverboard and the problem is still there; we're at https://devfest.gdgsudbury.ca - this is from the console on Firefox 49 on Linux:

Failed to load ‘https://devfest.gdgsudbury.ca/’. A ServiceWorker passed a redirected Response to FetchEvent.respondWith() while RedirectMode is not ‘follow’.

But if you access the site via https://gdg-sudbury-devfest.firebaseapp.com/ then reloading appears to work just fine.

MrCsabaToth commented 7 years ago

Maybe it's something about configuration. The site URL is in several places, like https://github.com/gdgfresno/valleydevfest/blob/develop/data/hoverboard.config.json#L76 , https://github.com/gdg-x/hoverboard/blob/master/index.html#L16 etc.

dbs commented 7 years ago

http://stackoverflow.com/questions/40274429/corrupted-content-error-on-firefox-with-polymer-firebase makes me wonder if it's a common issue with polymer-cli (which depends on polymer-build, which depends on sw-precache to generate service-worker.js) on Firebase.

htchien commented 7 years ago

Hi,

We also have this issue with our DevFest Taipei website (we were using the master branch):

https://devfest-taipei-3cbee.firebaseapp.com/

With Firefox Developer Edition v52 on Mac it would show the "Corrupted content error" page; And with Chrome v54 on Mac sometimes the local cache will be refreshed properly, but most of time it would just load the local cache version and would not refresh the site....

Is there a way to turn the local cache off in the ServiceWorker.js? This is really bothering us...

MrCsabaToth commented 7 years ago

@htchien If it's about stale service worker, I accidentally came across this at DevFest SF: reg.update();

https://developers.google.com/web/fundamentals/instant-and-offline/service-worker/lifecycle#manual_updates

This update call basically makes it work as it should by default IMHO. The old worker won't linger around (for no reason) that much. I haven't tried this in production yet, just poked around and confirmed in a dev environ.

htchien commented 7 years ago

@MrCsabaToth I believe in Hoverboard the service worker is not on in dev environ. unless I mis-understanding the code?

MrCsabaToth commented 7 years ago

@htchien In my experience older service worker can get stuck even while developing. It helps if you work in a private window to start from a clean state. Manual update seems to solve that problem, as I mentioned it should be default behavior IMHO.

htchien commented 7 years ago

I decided to remove the Service Worker on our DevFest site because it bothers us that the site cannot be refreshed properly while service working is on. If service worker can be fixed in the future then I will add it back.

friedger commented 7 years ago

Fixing service-worker.js (install with fetch redirect: 'follow') manually seems to work.

friedger commented 7 years ago

I have created an issue here: https://github.com/GoogleChrome/sw-precache/issues/220

friedger commented 7 years ago

@ozasadnyy Thank you for the hard work and follow up!

ozasadnyy commented 7 years ago

@friedger you are welcome :) Next time we should fixing such issues much faster!

friedger commented 7 years ago

This one much dependent on Google's sw-precache

hikeislife commented 4 years ago

you say this issue is fixed, but I am just now experiencing it, on both firefox and chrome (brave). the only diff is that firefox stays on oops page until I reload it, and chrome (brave) reloads itself split second later, but only after showing "the site can't be reached" - it's there long enough to read what it says before the reload occurs. the page is not hosted anywhere, I'm still in early stages of dev it's all happening on localhost

abraham commented 4 years ago

@hikeislife This issue has been closed for a long time. Please open a new one and include as much details about what you are seeing as possible.