-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Bug]: terminal not working when your web base_path is not / #5321
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
I am experiencing the same issue. Julia/Python REPL and R terminal are also not working. Furthermore, the Jupyter extension fails to activate. |
@jsjoeio The changes regarding diff --git a/opt/code-server-4.4.0/lib/vscode/out/vs/code/browser/workbench/workbench.html b/opt/code-server-4.5.0/lib/vscode/out/vs/code/browser/workbench/workbench.html
index 2adf1b0..3ceda51 100644
--- a/opt/code-server-4.4.0/lib/vscode/out/vs/code/browser/workbench/workbench.html
+++ b/opt/code-server-4.5.0/lib/vscode/out/vs/code/browser/workbench/workbench.html
@@ -28,9 +28,9 @@
<!-- Workbench Icon/Manifest/CSS -->
<link rel="icon" href="{{BASE}}/_static/src/browser/media/favicon-dark-support.svg" />
- <link rel="alternate icon" href="{{BASE}}/_static/src/browser/media/favicon.ico" type="image/x-icon" />
+ <link rel="alternate icon" href="{{BASE}}/_static/src/browser/media/favicon.ico" />
<link rel="manifest" href="{{VS_BASE}}/manifest.json" crossorigin="use-credentials" />
- <link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="{{WORKBENCH_WEB_BASE_URL}}/out/vs/workbench/workbench.web.main.css">
+ <link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="{{VS_BASE}}/static/out/vs/workbench/workbench.web.main.css">
</head>
@@ -38,26 +38,21 @@
</body>
<!-- Startup (do not modify order of script tags!) -->
- <script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/loader.js"></script>
- <script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/webPackagePaths.js"></script>
+ <script src="{{VS_BASE}}/static/out/vs/loader.js"></script>
+ <script src="{{VS_BASE}}/static/out/vs/webPackagePaths.js"></script>
<script>
- const baseUrl = new URL('{{WORKBENCH_WEB_BASE_URL}}', window.location.origin).toString();
- Object.keys(self.webPackagePaths).map(function (key, index) {
- self.webPackagePaths[key] = `${baseUrl}/node_modules/${key}/${self.webPackagePaths[key]}`;
- });
-
- const nlsConfig = {};
+ let nlsConfig
try {
- nlsConfig['vs/nls'] = JSON.parse(document.getElementById("vscode-remote-nls-configuration").getAttribute("data-settings"))
- if (nlsConfig['vs/nls']._resolvedLanguagePackCoreLocation) {
+ nlsConfig = JSON.parse(document.getElementById("vscode-remote-nls-configuration").getAttribute("data-settings"))
+ if (nlsConfig._resolvedLanguagePackCoreLocation) {
const bundles = Object.create(null)
- nlsConfig['vs/nls'].loadBundle = (bundle, _language, cb) => {
+ nlsConfig.loadBundle = (bundle, _language, cb) => {
const result = bundles[bundle]
if (result) {
return cb(undefined, result)
}
- const path = nlsConfig['vs/nls']._resolvedLanguagePackCoreLocation + "/" + bundle.replace(/\//g, "!") + ".nls.json"
- fetch(`{{WORKBENCH_WEB_BASE_URL}}/vscode-remote-resource?path=${encodeURIComponent(path)}`)
+ const path = nlsConfig._resolvedLanguagePackCoreLocation + "/" + bundle.replace(/\//g, "!") + ".nls.json"
+ fetch(`{{VS_BASE}}/vscode-remote-resource?path=${encodeURIComponent(path)}`)
.then((response) => response.json())
.then((json) => {
bundles[bundle] = json
@@ -67,9 +62,14 @@
}
}
} catch (error) { /* Probably fine. */ }
-
+ Object.keys(self.webPackagePaths).map(function (key, index) {
+ self.webPackagePaths[key] = new URL(
+ `{{VS_BASE}}/static/node_modules/${key}/${self.webPackagePaths[key]}`,
+ window.location,
+ ).toString();
+ });
require.config({
- baseUrl: `${baseUrl}/out`,
+ baseUrl: new URL(`{{VS_BASE}}/static/out`, window.location).toString(),
recordStats: true,
trustedTypesPolicy: window.trustedTypes?.createPolicy('amdLoader', {
createScriptURL(value) {
@@ -77,13 +77,13 @@
}
}),
paths: self.webPackagePaths,
- ...nlsConfig
+ 'vs/nls': nlsConfig,
});
</script>
<script>
performance.mark('code/willLoadWorkbenchMain');
</script>
- <script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/workbench/workbench.web.main.nls.js"></script>
- <script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/workbench/workbench.web.main.js"></script>
- <script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/code/browser/workbench/workbench.js"></script>
+ <script src="{{VS_BASE}}/static/out/vs/workbench/workbench.web.main.nls.js"></script>
+ <script src="{{VS_BASE}}/static/out/vs/workbench/workbench.web.main.js"></script>
+ <script src="{{VS_BASE}}/static/out/vs/code/browser/workbench/workbench.js"></script>
</html> |
Having the same issue, staying on 4.40v for the time being |
➕ same issue
network request path is wrong some of the files load with correct path, (in the img, it should be "https://{hostname}/code/{other stuff}" |
same issue,and python extension fails to activate. |
Cross reference: #5326 |
Hi all - thank you for the reports and the details! We had all last week off for the holidays so I'm just now seeing this. @code-asher is out until Thursday. I'm going to start investigating this today. Hoping I should be able to easily reproduce with Caddy |
Investigation NotesI'll update this comment with my findings as I investigate this issue. The IssueFolks are having issues using the Integrated Terminal when they run code-server no on the root path i.e. Steps to reproduce
# Caddyfile
http://localhost:8082/ide/* {
uri strip_prefix /ide
reverse_proxy 127.0.0.1:8080
}
ScreenshotWhat could have caused this?Whenever issues like this happen, it's usually related to a VS Code upgrade which is the most brittle part of the codebase. @benz0li left a helpful diff here to show any changes related to I'm going to look at the commits for the 1.68 upgrade to see what we documented about the change. Nothing stands out in particular there. It seems like the I don't see any recent changes so i'm hesitant to believe the change is there. Based on the diff provided earlier, I think this could be related: - const baseUrl = new URL('{{WORKBENCH_WEB_BASE_URL}}', window.location.origin).toString();
+ const baseUrl = new URL('{{WORKBENCH_WEB_BASE_URL}}', window.location).toString();
Object.keys(self.webPackagePaths).map(function (key, index) {
self.webPackagePaths[key] = `${baseUrl}/remote/web/node_modules/${key}/${self.webPackagePaths[key]}`;
}); The only difference is using Strangely, the MDN docs say the second argument to This is in an HTML file inside a Actually...that may not be accurate.
So this means it went from using the
which seems the right call 🤔 https://jsfiddle.net/5ca3um8x/5/ meaning I don't know if that's the issue here. digging around i found
thinking out loud...feels like we have logic in place to make sure
oddly enough, Well, when I change this means using And if you look upstream, they both use that as well:
I think this is enough evidence to open a PR so that CI builds and we can test a full build via npm. Wait actually...now I'm not sure 🤔 That change to But it also makes me question why we'd make that change in I'll open a PR and test a build anyway. Unsurprisingly, that did not work. I'm starting back on this again. Next, I'm looking at all changed files between 4.4.0 and 4.5.0. We did change the order of the patches to make it easier apply the display patch. See here. I wonder if that could have caused this. I may try applying all the patches but the display language and see if that work. No luck there. So this 983269f works locally when you run code-server in development mode aka @oxy and I paired on this. We paired on this. We made the correct change in |
Is there an existing issue for this?
OS/Web Information
code-server --version
: 4.5.0 02b9d7e with Code 1.68.1Steps to Reproduce
Expected
show terminal
Actual
No terminal created.
open chrome dev Terminal, you will see some errors like this:
but the root path of ide is
/ide/
, not/
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
Are you accessing code-server over HTTPS?
Notes
If your root path is /, terminal will open correctly.
The text was updated successfully, but these errors were encountered: