Skip to content

ServiceWorker's Fetch Handler Doesn't Return a Valid Response #2760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JammSpread opened this issue Feb 24, 2021 · 13 comments
Closed

ServiceWorker's Fetch Handler Doesn't Return a Valid Response #2760

JammSpread opened this issue Feb 24, 2021 · 13 comments
Labels
feature New user visible feature

Comments

@JammSpread
Copy link
Contributor

JammSpread commented Feb 24, 2021

Around mid-2021 Google seems to want to enforce PWAs have proper fetch handlers.
The consequence being no installability on at least Chrome.

I think it would be best to make sure that this is resolved prior to that "deadline".
(Although it's February so this may be too early.)

I'm thinking either #2007 (which may require that #1925 be reopened) could be reverted, or a page similar to the error page could be returned notifying the user that code-server cannot be used offline.

(You may be able to test this functionality by using the Chrome flag check-offline-capability.)

See more:

@JammSpread JammSpread added the feature New user visible feature label Feb 24, 2021
@JammSpread
Copy link
Contributor Author

I'm thinking either #2007 (which may require that #1925 be reopened) could be reverted, or a page similar to the error page could be returned notifying the user that code-server cannot be used offline.

(Maybe the latter may look something like this):

Offline

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 24, 2021

The consequence being no installability on at least Chrome.

We definitely don't want that to happen. Thanks for bringing this up sooner rather than later 🙌

I did see this as well in the link you provided:

TL;DR: Offline support has been part of the PWA installability criteria since the beginning. We are updating the offline detection logic to ensure a PWA actually provides an offline experience, closing the loophole used by some developers to meet the installability critiera. In the future, sites with empty fetch event handlers will no longer meet the criteria.

I'm actually in the middle of adding tests for our service worker code and thought it was strange we don't actually use the fetch handler in our service worker. It does nothing and I even have a test to make sure it does nothing 😂 (see here).

^I like the page you designed here above. Matches our other pages and communicates the issue clearly.

It sounds like we'll need to do two things:

  • fix serviceWorker fetch handler (see example)
  • add offline fallback page (see examples)

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 24, 2021

Adding help-wanted in case anyone wants to grab this. Otherwise, I'll probably end up doing it

@jsjoeio jsjoeio added this to the v3.9.2 milestone Feb 24, 2021
@greyscaled
Copy link
Contributor

@jsjoeio Could be a great one for me to pick up

@greyscaled greyscaled self-assigned this Mar 5, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 5, 2021

Woo! All you! ♥️

@jsjoeio jsjoeio modified the milestones: v3.9.2, v3.9.3 Mar 16, 2021
@jsjoeio jsjoeio modified the milestones: v3.9.3, On Deck Apr 8, 2021
@greyscaled
Copy link
Contributor

@jsjoeio - I'm promising this by the first June milestone, with optimal hopes to get to it in the last week of May. Feel free to modify the milestones around this - and thanks for the patience!

@greyscaled
Copy link
Contributor

Interesting updated - from one of the linked to articles Improving Progressive Web App offline support detection

An edit has been made:

Updated April 14th, 2021: We previously announced plans to update the installability criteria to ensure a PWA actually provides an offline experience. After listening to your feedback, and discovering a number of issues, we have decided to put those plans on hold. We strongly believe providing a valid page when the user is offline is critical to providing a good user experience.


It seems we have more time to implement #2760 , though I don't think that means we should hold off. What it does mean, however, is we must continually monitor emerging PWA technologies.

@greyscaled greyscaled modified the milestones: On Deck, v3.9.4 Apr 30, 2021
@oxy oxy modified the milestones: v3.10.0, v3.11.0 May 7, 2021
@code-asher code-asher modified the milestones: v3.10.1, 3.11.0 May 17, 2021
@jsjoeio jsjoeio modified the milestones: 3.10.2, 3.11.0 May 21, 2021
@jsjoeio jsjoeio modified the milestones: 3.11.0, 3.12.0 Jul 19, 2021
@jsjoeio jsjoeio modified the milestones: 3.12.0, On Deck Sep 9, 2021
@stale
Copy link

stale bot commented Mar 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.

@stale stale bot added the stale label Mar 8, 2022
@jsjoeio
Copy link
Contributor

jsjoeio commented Mar 8, 2022

Not stale

@stale stale bot removed the stale label Mar 8, 2022
@code-asher code-asher closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2024
@douglasparker
Copy link

@code-asher can you please communicate why this is closed as not planned, so everyone following this issue isn’t left in the dark?

@greyscaled greyscaled removed their assignment Jul 13, 2024
@code-asher
Copy link
Member

It could be I misunderstood. From what I could tell, this is not going to change, so there is nothing we have to implement?

@douglasparker
Copy link

It could be I misunderstood. From what I could tell, this is not going to change, so there is nothing we have to implement?

Nothing that I have seen indicates that this is not going to change- Google has merely said that it is currently on hold.

@code-asher
Copy link
Member

Definitely happy to reopen if that changes. PRs also welcome! Although, I think the long-term move might be to use VS Code's service worker rather than our own, but this will require some investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New user visible feature
Projects
None yet
Development

No branches or pull requests

6 participants