You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
net::ERR_ABORTED 401
excalidraw cannot be rendered
Logs
browser console:
Request URL:
https://vscode-remote+vscode-002emydomain-002etop.vscode-resource.vscode-cdn.net/root/.local/share/code-server/extensions/pomdtr.excalidraw-editor-3.5.2-universal/public/static/js/main.7ef26bea.js
Request Method:
GET
Status Code:
401 (from service worker)
Referrer Policy:
strict-origin-when-cross-origin
Request URL:
https://vscode-remote+vscode-002emydomain-002etop.vscode-resource.vscode-cdn.net/root/.local/share/code-server/extensions/pomdtr.excalidraw-editor-3.5.2-universal/public/static/css/main.11acca1e.css
Request Method:
GET
Status Code:
401 (from service worker)
Referrer Policy:
strict-origin-when-cross-origin
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
The behavior I am seeing is a bit different.
excalidraw-editor is working for me (I can create demo.excalidraw
and draw shapes) on code-server 4.14.1 if I install via the
command line (I tried both Firefox and Chromium).
Is there anything at all unusual about your setup? I am not sure
where the 401 would be coming from. I enabled password
authentication but that works for me as well. Does this reproduce
for you in an incognito window? Or in another browser?
Interestingly though, if I install via the UI it gets installed as
a browser extension and does not work although I am not seeing 401
errors then either. I do see some 404s and 406s trying to make
requests to open-vsx.org though. But this seems to be a different
issue.
https - I used caddy. And I upgraded from 4.13.0 to 4.14.1, I just replaced all the files in the project's root directory. Some files like cache or extension package may not have been replaced. I'm not sure if those are the reasons, but I'll do the test again sometime.
(Caddy file: Note that use tabs instead of 4/8 Spaces. Otherwise, the fmt command may have a problem)
.5. start caddy: execute command: caddy fmt && caddy adapt && caddy run
Install code-server
.1. Download code-server-4.14.1-linux-amd64.tar.gz link
.2. tar -zxvf code-server-4.14.1-linux-amd64.tar.gz
.3. cd code-server-4.14.1-linux-amd64/bin/
.4. ./code-server --install-extension pomdtr.excalidraw-editor
.5. PASSWORD=123456 VSCODE_PROXY_URI=https://{{port}}.vscode.testserver.dev ./code-server --bind-addr 127.0.0.1:23456 --proxy-domain vscode.testserver.dev
Modify system host-file. Add vscode.testserver.dev 192.168.1.10
Install /root/.local/share/caddy/pki/authorities/local/root.crt to the (visiter)system's trusted root certificate.(My visiter system is win11)
Is the self-signed certificate trusted on your browser?
Caddy is supposed to install them for you but in my case I had to add Caddy's CA to Chrome's trust store to even get it to load the site. Once I loaded the site Excalidraw worked for me.
I am running this on Ubuntu though.
Do you get the same issue without TLS through Caddy? Although I am not sure how a cert issue could cause a 401 so this might not be relevant.
What if you load it directly without a reverse proxy?
Self-signed certificates are trusted.I'm sorry. I missed a step.
Install /root/.local/share/caddy/pki/authorities/local/root.crt to the (win)system's trusted root certificate.
No reverse proxy:
I also tried to directly use code-server --cert --cert-key to load the certificate generated by caddy, but I still had the same problem.
Command is PASSWORD=123456 VSCODE_PROXY_URI=https://{{port}}.vscode.testserver.dev ./code-server --bind-addr 0.0.0.0:443 --cert /root/.local/share/caddy/certificates/local/vscode.testserver.dev/vscode.testserver.dev.crt --cert-key /root/.local/share/caddy/certificates/local/vscode.testserver.dev/vscode.testserver.dev.key --proxy-domain vscode.testserver.dev
Strangely, static resources for other extensions, such as draw.io, load normally.
So I don't really know whose bug it is.
Do some extensions require specific permissions? That's just my guess...
Interesting! I tried to reproduce with a CentOS Docker image but
it still works for me. Maybe it does not reproduce in Docker?
Here is what I tried:
```
docker run -it -p 8080:8080 centos sh
curl -L https://code-server.dev/install.sh | sh
code-server --install-extension pomdtr.excalidraw-editor
PASSWORD=test code-server --host 0.0.0.0
```
Then I opened a private window (to make sure my cache was clear)
and went to http://localhost:8080/?folder=/root.
`code-server: 4.13.0` doesn't have that problem, 4.13.0 to
4.14.1 are there some security-related changes that caused this
problem?
Very strange. I am not seeing anything that could be affecting
this. I do not believe any changes to authentication were made,
at least.
There was an update to VS Code though. These particular assets
are requested through the service worker so maybe a change was
made there that caused this.
Do you still get the 401 if you use --auth none? Just to see if
the 401 is coming from code-server or somewhere else.
So strange, if auth is off then I have no idea where the 401 comes
from.
To double-check, have you already tried in a private/incognito
window to rule out caching issues with the service worker?
I did briefly try to launch a CentOS VM but for some reason I am
having trouble getting the networking to work so for now this is
as far as I can go.
solves the issue on latest code-server with the latest version of the extension code-server: v4.18.0 Excalidraw v3.6.1 on Debian testing
Yes, those two resources main.75859edd.js and main.11acca1e.css
In my browser, these two resources 401.
I tried to go over and change the settings auth: none . Still have bugs.
code-server: v4.18.0
Excalidraw v3.6.1
on Rocky Linux release 9.1 (Blue Onyx)
But interesting...
I saw successful access to the resource the moment I restarted code-server. Only once, a bug appears after refreshing
To avoid caching, I tried to execute the browser in the sandbox, but it didn't work.
I am not still not sure what is going on, but I can at least comment on the weird vscode-remote+ URLs. I think (but am not sure) that VS Code registers network interceptors in the service worker so these requests are not actually made normally, instead the interceptor fetches the content through the web socket and then replies to the request with that data.
But as to why they 401 in that case...no idea. I am not sure if I have tried with auth on yet so I will have to give it a go.
Closing for now since the problem does not seem to be in code-server, but please feel free to continue commenting, and we can reopen if we discover anything.
still experiencing this with the latest version of code-server, as well as excalidraw extension. It looks like either the extension (or code-server) is causing the extension to load it's web assets directly from openvsx.org, rather than through the virtual filesystem with the files embedded in the extension.
I looked at the code of the extension, and it doesn't look any different from other extensions loading assets (index.html/css for embedded web views), and it doesn't occur when running the excalidraw extension locally/outside of code-server.
I believe this is an issue with code server, or whatever code-server is based off, which is providing the wrong base/file URL to the extension, for which it tries to load things.
EDIT:
Yes, i must admit the solution works only if I disable/enable the extension and reload the app once more after opening code-server on client side.
I have found that when the browser version is uninstalled, but it still is installed (on code-server), this seems to work (at least in our case, because the server doesn't have the same corporate firewall restrictions). however, I haven't found a way to tell an extension to only be server-side, if the extension supports browser and server. So the next reload often causes it to break again.
Yeah I noticed the same thing. I think the only way to make it install on the server is to use --install-extension via the cli, and not install through the UI.
Edit: I believe browser extensions pull their files directly from the marketplace, so this is by design even though personally I think they should have downloaded it to the remote and pulled the files off there. Maybe it was done this way to also support vscode.dev which has no backend though.
Even if the extension "works", the problem is that something is causing the extension to load files directly from openvsx.org, rather than from within code-server and the virtual filesystem endpoints. It only becomes a problem if you cannot connect to openvsx.org (or similar). Some more info below.
create a new file called test.excalidraw.png (or some other way of opening the view for excalidraw)
look at the network tab within dev tools, and find the endpoints that are being hit being openvsx.org (and others).
In my case, I am running this test from my personal device, so there are no network issues reaching outbound. This does not work in many corporate environments, however.
This is an issue for a few reasons:
code-server runs from one environment, but the browser runs from another. In corporate environments, or environments with some kind of internet firewall, this can be problematic as code-server may be less restrictive than the browser and creates inconsistencies/network requires that would be unexpected.
the files in question are bundled with the extension, so it shouldn't need to reach out to those endpoints.
when I try something similar with vscode locally, not code-server, I don't see that it reaches out to microsofts marketplace or some other external endpoint.
not sure how or where this.context.extensionUri (where I think the source of the issue may be) is an external URL, rather than some virtual fs endpoint of some kind.
the problem is that something is causing the extension to load files directly from openvsx.org
I agree this is dumb, but as mentioned this is just how web extensions work by design as far as I can tell so not much we can do about it, except maybe file an issue with VS Code.
You should see similar requests on the web versions of VS Code like vscode.dev and Codespaces, but not with the desktop version as it does not use web extensions.
This is controlled by the resourceUrlTemplate property of the extension gallery, which is configurable via the EXTENSIONS_GALLERY environment variable so one workaround would be to omit resourceUrlTemplate which I believe would disable web extensions altogether. But, this might not be ideal because some extensions you might want to be web extensions, like Vim to avoid round trips every time you type a character.
For restrictive corporate environments typically the folks we work with host their own marketplace on premise using https://github.com/coder/code-marketplace, or the marketplace is proxied or whitelisted, if that helps.
They have to do this even without using web extensions anyway, because extension queries (like searching for extensions) also occur from the browser, last I checked.
Activity
Gu-f commentedon Jul 6, 2023
code-server: 4.13.0 2798322 with Code 1.78.2
After testing, this version of code-server works properly
pomdtr commentedon Jul 6, 2023
Thanks for the investigation!
code-asher commentedon Jul 13, 2023
Gu-f commentedon Jul 17, 2023
https - I used caddy. And I upgraded from 4.13.0 to 4.14.1, I just replaced all the files in the project's root directory. Some files like cache or extension package may not have been replaced. I'm not sure if those are the reasons, but I'll do the test again sometime.
Gu-f commentedon Jul 19, 2023
More complete reproduction steps:
vscode.testserver.dev 192.168.1.10/root/.local/share/caddy/pki/authorities/local/root.crtto the (visiter)system's trusted root certificate.(My visiter system is win11)demo.excalidrawdemo.excalidrawPlease try the above steps. Hopefully this will make the problem come up again.
I tried switching the system RockyLinux had the same problem.
code-asher commentedon Jul 19, 2023
Is the self-signed certificate trusted on your browser?
Caddy is supposed to install them for you but in my case I had to add Caddy's CA to Chrome's trust store to even get it to load the site. Once I loaded the site Excalidraw worked for me.
I am running this on Ubuntu though.
Do you get the same issue without TLS through Caddy? Although I am not sure how a cert issue could cause a 401 so this might not be relevant.
What if you load it directly without a reverse proxy?
Gu-f commentedon Jul 20, 2023
Self-signed certificates are trusted.I'm sorry. I missed a step.
Install
/root/.local/share/caddy/pki/authorities/local/root.crtto the (win)system's trusted root certificate.No reverse proxy:
I also tried to directly use code-server --cert --cert-key to load the certificate generated by caddy, but I still had the same problem.
Command is
PASSWORD=123456 VSCODE_PROXY_URI=https://{{port}}.vscode.testserver.dev ./code-server --bind-addr 0.0.0.0:443 --cert /root/.local/share/caddy/certificates/local/vscode.testserver.dev/vscode.testserver.dev.crt --cert-key /root/.local/share/caddy/certificates/local/vscode.testserver.dev/vscode.testserver.dev.key --proxy-domain vscode.testserver.devStrangely, static resources for other extensions, such as draw.io, load normally.
So I don't really know whose bug it is.
Do some extensions require specific permissions? That's just my guess...
Gu-f commentedon Jul 20, 2023
I tested ubuntu.
Oh my God! It only works properly on ubuntu systems !
Is there a better way to find out why other systems aren't working properly?
Gu-f commentedon Jul 20, 2023
code-server: 4.13.0doesn't have that problem, 4.13.0 to 4.14.1 are there some security-related changes that caused this problem?code-asher commentedon Jul 20, 2023
Gu-f commentedon Jul 21, 2023
The same problem occurs with --auth none. It looks like ServiceWorker.


The initiator located it here
I don't know if that helps.
In docker:
I tried it, too. Able to draw normally.
Outside docker:
I perform the same steps as you, except that I do not perform the first step.
401 came out.
Judging from the tests above, installing a centos/rocky system in a VM(I use VMware) should be easy to reproduce.
code-asher commentedon Jul 24, 2023
Gu-f commentedon Jul 25, 2023
Yes, I have tried the private/incognito window. I also tried to clear the cache, the problem still exists.
Note:
Release-v4.13.0 is the dividing line.
version le(<=) Release-v4.13.0: normal
version gt(>) Release-v4.13.0: abnormal (include latest v4.15.0)
12 remaining items
krisek commentedon Oct 26, 2023
setting
solves the issue on latest code-server with the latest version of the extension
code-server:
v4.18.0Excalidraw
v3.6.1on Debian
testingGu-f commentedon Oct 27, 2023
Yes, those two resources main.75859edd.js and main.11acca1e.css
In my browser, these two resources 401.
I tried to go over and change the settings
auth: none. Still have bugs.code-server:
v4.18.0Excalidraw
v3.6.1on Rocky Linux release 9.1 (Blue Onyx)
But interesting...
I saw successful access to the resource the moment I restarted code-server. Only once, a bug appears after refreshing
To avoid caching, I tried to execute the browser in the sandbox, but it didn't work.
krisek commentedon Oct 30, 2023
Yes, i must admit the solution works only if I disable/enable the extension and reload the app once more after opening code-server on client side.
code-asher commentedon Nov 16, 2023
I am not still not sure what is going on, but I can at least comment on the weird
vscode-remote+URLs. I think (but am not sure) that VS Code registers network interceptors in the service worker so these requests are not actually made normally, instead the interceptor fetches the content through the web socket and then replies to the request with that data.But as to why they 401 in that case...no idea. I am not sure if I have tried with auth on yet so I will have to give it a go.
code-asher commentedon Jul 13, 2024
Closing for now since the problem does not seem to be in code-server, but please feel free to continue commenting, and we can reopen if we discover anything.
krisek commentedon Jul 15, 2024
In the meanwhile I don't have this issue anymore, most probably subsequent updates fixed it
lrstanley commentedon Jul 15, 2024
still experiencing this with the latest version of code-server, as well as excalidraw extension. It looks like either the extension (or code-server) is causing the extension to load it's web assets directly from openvsx.org, rather than through the virtual filesystem with the files embedded in the extension.
I looked at the code of the extension, and it doesn't look any different from other extensions loading assets (index.html/css for embedded web views), and it doesn't occur when running the excalidraw extension locally/outside of code-server.
I believe this is an issue with code server, or whatever code-server is based off, which is providing the wrong base/file URL to the extension, for which it tries to load things.
EDIT:
I have found that when the browser version is uninstalled, but it still is installed (on code-server), this seems to work (at least in our case, because the server doesn't have the same corporate firewall restrictions). however, I haven't found a way to tell an extension to only be server-side, if the extension supports browser and server. So the next reload often causes it to break again.
code-asher commentedon Jul 16, 2024
Yeah I noticed the same thing. I think the only way to make it install on the server is to use
--install-extensionvia the cli, and not install through the UI.Edit: I believe browser extensions pull their files directly from the marketplace, so this is by design even though personally I think they should have downloaded it to the remote and pulled the files off there. Maybe it was done this way to also support vscode.dev which has no backend though.
code-asher commentedon Jul 16, 2024
Actually I just tried again on code-server 4.91.0 with it installed as a browser extension and it is working as expected. 🤔
lrstanley commentedon Jul 17, 2024
Even if the extension "works", the problem is that something is causing the extension to load files directly from openvsx.org, rather than from within code-server and the virtual filesystem endpoints. It only becomes a problem if you cannot connect to openvsx.org (or similar). Some more info below.
Reproduction steps:
http://localhost:8080pomdtr.excalidraw-editortest.excalidraw.png(or some other way of opening the view for excalidraw)In my case, I am running this test from my personal device, so there are no network issues reaching outbound. This does not work in many corporate environments, however.
This is an issue for a few reasons:
code-server info from the above test:
extension version:
v3.7.4lrstanley commentedon Jul 17, 2024
this is the code on the excalidraw extension side that does the loading of the webview content:
https://github.com/excalidraw/excalidraw-vscode/blob/42253cd9b74a21c8de60433a6eef574f458483b4/extension/src/editor.ts#L345-L363
looking at the official docs, I don't see anything wrong with this:
https://code.visualstudio.com/api/extension-guides/webview#loading-local-content
not sure how or where
this.context.extensionUri(where I think the source of the issue may be) is an external URL, rather than some virtual fs endpoint of some kind.code-asher commentedon Jul 17, 2024
I agree this is dumb, but as mentioned this is just how web extensions work by design as far as I can tell so not much we can do about it, except maybe file an issue with VS Code.
You should see similar requests on the web versions of VS Code like vscode.dev and Codespaces, but not with the desktop version as it does not use web extensions.
This is controlled by the
resourceUrlTemplateproperty of the extension gallery, which is configurable via theEXTENSIONS_GALLERYenvironment variable so one workaround would be to omitresourceUrlTemplatewhich I believe would disable web extensions altogether. But, this might not be ideal because some extensions you might want to be web extensions, like Vim to avoid round trips every time you type a character.code-asher commentedon Jul 17, 2024
For restrictive corporate environments typically the folks we work with host their own marketplace on premise using https://github.com/coder/code-marketplace, or the marketplace is proxied or whitelisted, if that helps.
They have to do this even without using web extensions anyway, because extension queries (like searching for extensions) also occur from the browser, last I checked.