microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.35k stars 28.6k forks source link

Cannot Debug PWA using Chromium 96 #138790

Closed 1John419 closed 2 years ago

1John419 commented 2 years ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Start local static web server (e.g., npm http-server) at workspaceFolder
  2. Launch vscode with all extensions disabled
  3. Open PWA project
  4. Launch debugger using Chromium 96
  5. Observe PWA fails to load
  6. In Dev Tools>Application>Service Workers, observe that service worker status is 'trying to install'
  7. Close debugger
  8. Launch debugger using Chromium 95 (or msedge 95)
  9. Observe PWA loads successfully
  10. In Dev Tools>Application>Service Workers, observe that service worker status is 'activated and is running'
  11. Close vscode
  12. Open Chromium 96 browser (standalone)
  13. Enter local web server URL
  14. Observe PWA loads successfully
  15. In Dev Tools>Application>Service Workers, observe that service worker status is 'activated and is running'

Please see attached screencast for complete demonstration.

https://user-images.githubusercontent.com/46386951/145477423-212559b1-dd9d-4807-89de-ca5d4e5a04b4.mp4

weinand commented 2 years ago

@1John419

1John419 commented 2 years ago

Yes, I noticed the screencast is audio only on GitHub (not sure why). However, I found it does play correctly when downloaded.

I am referring to vscode's builtin debugger.

Please let me know if screencast still doesn't work (I had to cut FPS and use high compression to meet the 10M limit) and I'll produce another version. Or, you can download the original video here:

https://mega.nz/file/9LA1TIBT#1Xb9KbcU4k2rcQfXvKfH4tS82uHIIISPvRJWVl8Xyec

Also, for a very simple PWA project, you could use this:

https://github.com/jamesjohnson280/hello-pwa

I found this project also exhibits the same 'trying to install' problem with Chromium 96 (so it's not just my PWA).

1John419 commented 2 years ago

FYI, I found the same 'trying to install' issue on Ubuntu 20.04 LTS.

It also occurs in Chromium 99 Development Build on Windows 10.

1John419 commented 2 years ago

If it helps...

I've observed debugging Chromium 96, the web server does not receive a GET request for sw.js until AFTER the browser is closed. Terminal output (added annotations marked with **):

Starting up http-server, serving D:\Users\Clayton\Code\Web\hello-pwa-master

http-server version: 14.0.0

http-server settings: 
CORS: disabled
Cache: -1 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://192.168.4.54: 5050
  http://127.0.0.1: 5050
Hit CTRL-C to stop the server

** Debugger launched

[2021-12-15T22:37:44.111Z]  "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4768.0 Safari/537.36"
(node:9724) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-12-15T22:37:44.127Z]  "GET /css/style.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4768.0 Safari/537.36"
[2021-12-15T22:37:44.128Z]  "GET /js/main.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4768.0 Safari/537.36"
[2021-12-15T22:37:44.445Z]  "GET /manifest.json" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4768.0 Safari/537.36"
[2021-12-15T22:37:44.456Z]  "GET /images/hello-icon-144.png" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4768.0 Safari/537.36"

** Browser closed

[2021-12-15T22:37:56.519Z]  "GET /sw.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
(KHTML, like Gecko) Chrome/99.0.4768.0 Safari/537.36"

This behavior is not observed running Chromium 96 standalone or debugging Chromium 95 (as shown below):

Starting up http-server, serving D:\Users\Clayton\Code\Web\hello-pwa-master

http-server version: 14.0.0

http-server settings: 
CORS: disabled
Cache: -1 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://192.168.4.54: 5050
  http://127.0.0.1: 5050
Hit CTRL-C to stop the server

** Debugger launched

[2021-12-15T22:47:31.386Z]  "GET /manifest.json" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
(node:4960) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-12-15T22:47:31.405Z]  "GET /images/hello-icon-144.png" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
**
[2021-12-15T22:47:33.573Z]  "GET /sw.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
(KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
**
[2021-12-15T22:47:33.684Z]  "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
[2021-12-15T22:47:33.686Z]  "GET /index.html" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
[2021-12-15T22:47:33.690Z]  "GET /css/style.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
[2021-12-15T22:47:33.691Z]  "GET /js/main.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"

** Browser closed

UPDATE: The GET sw.js request after the browser is closed occurs ONLY when the web server is started as a vscode task. It does not occur when web server is started in a separate cmd window. Strange.

connor4312 commented 2 years ago

This appears to be a Chromium bug, which I opened on https://bugs.chromium.org/p/chromium/issues/detail?id=1281013. I put in a temporary workaround however.