-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Bug]: Image not showing up #4800
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
Additionally "Cannot reconnect. Please reload the window." pops up after some minutes... that's probably related. |
I was able to reproduce this locally on macOS + Brave with Error loading webview: Error: Could not register service workers: SecurityError:
Failed to register a ServiceWorker for scope ('https://localhost/webview/6659afd9-08e4-4b14-9528-570c9d7107cc/') with script
('https://localhost/webview/6659afd9-08e4-4b14-9528-570c9d7107cc/service-worker.js?id=a8c6338a-43f4-450a-a373-44c7b0e0d34a&swVersion=2&extensionId=&platform=browser&vscode-resource-base-authority=vscode-resource.vscode-webview.net&parentOrigin=https%3A%2F%2Flocalhost'):
An SSL certificate error occurred when fetching the script.. @code-asher any ideas on where to troubleshoot the cause of this? I haven't spent much time generating SSL certificates locally before. I wonder what broke there. |
In the meantime, you can use version 3.9.1 if you really have to display images:
|
Seems likely to be the same issue as #4693 (comment) |
I updated to version 4.0.2 and this issue seems to be fixed! |
Still not working for me. I have the following setup: docker-compose.yml:
config.yaml:
I access it using a tunnel (Ngrok) |
I realised that it did work when docker was running on the same machine, but not when code server was on another machine. Reopening. |
I tried the same Dockerfile on two machines, localhost and another. My browser (Brave Browser) one time shows an exclamation mark with a circle around it (localhost) and on the remote machine it shows an exclamation mark with a triangle around it (for "connection security" next to the URL). On localhost the image is shown, from the remote host it isn't. Maybe this message in console is a hint:
I don't see this on localhost. Creating an ssh tunnel ssh -L ... to the remote server showed, that the image does show as soon as the address is "http://localhost...". Note: Disabling private/incognito mode was not possible (my browser wasn't in incognito mode) and even disabling "Brave Shields" didn't help. I was able to reproduce this with Safari, it's just the same, localhost works, remote doesn't. I'm running code-server inside docker, it is |
Images are rendered in webviews. Webviews use Service Workers. Browsers require HTTPS to enable Service Workers. Therefore, this isn't a bug in code-server since it's not something we can change :( The only solution I can offer is to use HTTPS |
But why does it work on localhost? Maybe browsers don't block Service Workers over http on localhost? |
When I run code server with "--cert" to ask it to generate self-signed certificates i get
when I click on an image... So https seems to be broken :-( |
I don't fully understand why/how it works, but yes, I think browsers allow localhost. See this answer on S/O
I believe this is a different error which should be fixed in the next version: #4773 |
Thank you for mentioning this issue there! Let's hope this can be fixed "at the source". |
I am also seeing the 'reconnect' issue with code-server v4.0.2 -- which is the latest release available at this time (18 Feb 2022) I do hope a new release is provided soon, as in 2 week the new semester begins and I would like to upgrade the version the students are using. |
@ky1emoon can you try with 4.2.0? Based on that error, it seems like you're not using HTTPS or your browser doesn't recognize the validity of your certificate perhaps. You could also share browser logs. |
Can someone verify if this is still an issue with 4.2.0? |
I have install v4.2.0 in testing. Looks like the reconnect issue has been resolved as I am not seeing them any more. |
I am using v4.2.0, still has this problem |
I am also using v4.2.0 now, seeing
This error comes up on localhost and when I connect from another computer. BUT: I realised that Safari does show the image from another computer and on localhost - it doesn't bring up the certificate problem. However Brave Browser |
Hmm...okay we will have to dig into this again. Sorry y'all! Thank you for the notes! |
That could well be related to #4421 i suppose... |
@gogobd thanks for confirming! Are you sure that your browser sees your SSL certificate as valid? |
@jsjoeio I always have to confirm that I want to accept the certificate: After confirming the browser marks it as not secure: I run code-sever in docker using `--cert' : CMD ~/.local/bin/code-server --cert --bind-addr 0.0.0.0:8080 /app |
Thanks for the details! That part sounds like it's working as expected 🤔 We'll have to dig into this. |
I was wondering if there's any news on this... |
Unfortunately not :( I've been pulled onto another project so my code-server work as slowed down this month. Hopefully soon though! PRs/help welcome though |
This could all be the same problem, I'm using "--cert", see #5338 |
I think something changed in Chromium that prevents it from accepting self-signed certificates or something 🤔 cc @code-asher do you remember where we read that? |
I was trying to allow insecure certificates from localhost with |
I found a way to get Brave to work on MacOS. This might also be an acceptable workaround for #5338 . |
Yeah if I recall correctly it will unequivocally refuse certificates it deems insecure for web workers (which are used by web views). Other browsers like Firefox are OK using it for web workers as long as you accept the initial prompt. |
@gogobd Please close the issue when it is resolved. |
Note: |
Is there an existing issue for this?
OS/Web Information
code-server --version
: 4.0.1 735c6daSteps to Reproduce
Expected
Image should be shown in editor
Actual
An SSL certificate error occurred when fetching the script.
log.ts:313 ERR [Service Worker] registration DOMException: Failed to register a ServiceWorker for scope ('https://--server--/') with script ('https://--server--/service-worker.js'): An SSL certificate error occurred when fetching the script.
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code?
Are you accessing code-server over HTTPS?
Notes
Please note i'm running it in docker but 443 is exposed (via 8080 in my case).
This is a re-opening of #4658
The text was updated successfully, but these errors were encountered: