-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Image previewer does not work #3826
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
Comments
Same issue with a blank webview for images ( Downgraded to |
Hmm...I wonder if something changed with the VSCode upgrade in 3.11. Thanks for the bug report! We'll investigate. |
When I was looking to find out what causes this, I stumbled upon this issue: microsoft/vscode#98768 Given that it was resolved months ago, I can't be sure if this is what's affecting the latest code-server build, but I didn't have time to figure out when this fix was released upstream. Maybe worth looking into. |
@pelletencate yep the CSP error I saw was a service worker calling a uri like microsoft/vscode#98768 (comment) |
Seeing a similar problem here in version 3.10.2. Web views (e.g. markdown preview and also ones from custom extensions) fail to load around 10% of the time.
|
Thanks for the notes @Livven! I'm seeing similar issues with web views in 3.11. We're currently investigating. More details here: #3883 (reply in thread) |
Just wanted to confirm that I did see very intermittent webview errors on |
As a temporary workaround, you should be able to use 3.9.3 (when we tested yesterday, we didn't see any issues with webviews there) |
Thanks for your help @jsjoeio. I tried out the fix in #3883 (reply in thread) but was still able to reproduce the issue. In fact, I am not 100% sure we are talking about the same issue since this one (or at least mine) happens only sporadically. |
Ah bummer. Thanks for the update @Livven - we'll have to dig into yours separately then. Feel free to open a bug report with repro steps. If we can reproduce yours consistently, we'll have a better chance at figuring out what it could be. |
Wow, @bowdens07 - thanks for the thorough investigation notes! That is extremely valuable. @code-asher might have some insight on this since he is a bit more familiar with webviews. We did recently introduce a patch in 3.11.1. Note: 3.11.1's publish workflow had some issues on npm/homebrew (not yet available) but it is available on Docker if you want to try that. |
I've checked out 3.11.1 and unfortunately can still reproduce the error through the SVG extension, at about a 2% rate. I would also like to point out that this version cannot open png, gif or jpg files. You'll get this error: I'm going to open up a new issue for it, because it's an unrelated error to this thread. Additionally, I started messing around with older versions. I found out I can't reproduce the webview error nor the failure to load png, gif, jpg, etc. on version 3.9.0. It's possible this isn't the boundary for the regression, but at the very least I know that version can run without a hitch. UPDATE: From version 3.9.3 to version 3.10.0 is where the webview failure was added. 3.9.3 works every time, we see png, jpg, gif, extension errors, etc. fail to load the webview in the same manner described in the initial bug report. I suggest investigating the changes between the versions to identify a potential regression |
Ahh, good to know. Thank for the thorough investigation. I'm surprised the 3.11.1 patch didn't fix it. I wonder what else it could be related to 🤔 At least we know where to start investigating. |
It looks like the service worker was introduced in version 1.56.0 of VS Code which is what 3.10.0 uses (3.9.3 uses 1.54). So I think it's highly likely something about the service worker intercepting requests is the failure point. |
That could be, although I am strongly inclined to believe that this preview failure never occurs in VS Code locally. I am unfamiliar with VS Code and Code-Sever in general, so maybe there's a interaction or edge case which can only occur on a web environment that I am unaware of. Since the bug reeks so much of a timing error, it's possible that local environments deterministically avoid a bad interleaving while the web IDE cannot. Then again, it could not be a timing error at all. Thank you for the continued support on this. |
I would also like to add I could have been mistaken. I have not been able to reproduce errors loading markdown and svg files in the previewer in the latest patch. It has, however broken some personal extensions in seemingly different ways. If the error posted about failing to load jpgs, pngs, etc., could be patched this could be more easily confirmed as solved. |
Local VS Code doesn't use service workers for the web view I believe,
instead they use some API natively provided by Electron. So service
workers are a web-only thing for VS Code.
I've also been seeing this frequently (using VS Code's `webview-sample`
extension) although I haven't tested on the latest patch. A timing
issue seems like a good possibility. I think with some logging around
this we could narrow it down pretty quickly.
|
Do you have any updates on this particular issue? Additionally, are you planning to address this issue by the next release? Thank you. |
No updates yet; currently we have this in the "On Deck" milestone so it
is a candidate for being worked on but not yet assigned to a release.
We are making some architectural changes to code-server so it might make
sense to wait until that is completed and we have updated to the latest
VS Code before tackling this because we may end up addressing some
instability issue in doing so.
|
This should be fixed by #4131 which will be included in the 3.12 release (planned to come out this week). |
I updated it to 3.12, however, this problem still exists. I does seem to give some informative information in the devtools console:
Tested on both Chrome and Edge and made sure I am not on private/incognito mode. |
@pwwang based on this error message, it sounds like it's related to your environment. You need service workers enabled. I'd suggest opening a Q and A Discussion and we can help you further! |
OS/Web Information
code-server --version
: 3.11.0 4e8cd09Steps to Reproduce
Expected
Should show the preview of the image
Actual
The editor shows nothing but just blank
Logs
Screenshot
while inspecting the body of the editor:
Notes
This issue can be reproduced in VS Code: No
This issue can be reproduced with code-server v3.10.2
The text was updated successfully, but these errors were encountered: