Skip to content

Failed to open Workspace from VSCode extension #10896

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

Closed
f0ssel opened this issue Nov 27, 2023 · 7 comments · Fixed by coder/modules#107 or coder/vscode-coder#174
Closed

Failed to open Workspace from VSCode extension #10896

f0ssel opened this issue Nov 27, 2023 · 7 comments · Fixed by coder/modules#107 or coder/vscode-coder#174
Assignees
Labels
s2 Broken use cases or features (with a workaround). Only humans may set this.

Comments

@f0ssel
Copy link
Contributor

f0ssel commented Nov 27, 2023

On a new ARM Macbook Pro I was joining the dev instance and after my workspace was brought up I clicked the "VS Code Desktop" button and had the extension install itself. Afterwards I get a error connection refused to localhost on port 80 and a dump of the error logs from SSH. I see no Coder extension logs.

SSH Output:

[12:55:33.021] Log Level: 2
[12:55:33.027] VS Code version: 1.84.2
[12:55:33.027] Remote-SSH version: remote-ssh@0.107.0
[12:55:33.027] darwin arm64
[12:55:35.033] SSH Resolver called for "ssh-remote+coder-vscode--f0ssel--dev", attempt 1
[12:55:35.034] "remote.SSH.useLocalServer": true
[12:55:35.034] "remote.SSH.useExecServer": false
[12:55:35.035] "remote.SSH.path": undefined
[12:55:35.035] "remote.SSH.configFile": undefined
[12:55:35.035] "remote.SSH.useFlock": true
[12:55:35.035] "remote.SSH.lockfilesInTmp": false
[12:55:35.035] "remote.SSH.localServerDownload": auto
[12:55:35.035] "remote.SSH.remoteServerListenOnSocket": false
[12:55:35.035] "remote.SSH.showLoginTerminal": false
[12:55:35.036] "remote.SSH.defaultExtensions": []
[12:55:35.036] "remote.SSH.loglevel": 2
[12:55:35.036] "remote.SSH.enableDynamicForwarding": true
[12:55:35.036] "remote.SSH.enableRemoteCommand": false
[12:55:35.036] "remote.SSH.serverPickPortsFromRange": {}
[12:55:35.037] "remote.SSH.serverInstallPath": {}
[12:55:35.048] SSH Resolver called for host: coder-vscode--f0ssel--dev
[12:55:35.048] Setting up SSH remote "coder-vscode--f0ssel--dev"
[12:55:35.050] Acquiring local install lock: /var/folders/08/0h5fg9lx04jc571c1731g3kr0000gn/T/vscode-remote-ssh-d6d3cfdd-install.lock
[12:55:35.051] Looking for existing server data file at /Users/f0ssel/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d6d3cfdd-1a5daa3a0231a0fbba4f14db7ec463cf99d7768e-0.107.0-tr/data.json
[12:55:35.052] Using commit id "1a5daa3a0231a0fbba4f14db7ec463cf99d7768e" and quality "stable" for server
[12:55:35.055] Install and start server if needed
[12:55:35.058] PATH: /usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
[12:55:35.058] Checking ssh with "ssh -V"
[12:55:35.063] > OpenSSH_9.4p1, LibreSSL 3.3.6

[12:55:35.065] askpass server listening on /var/folders/08/0h5fg9lx04jc571c1731g3kr0000gn/T/vscode-ssh-askpass-c38a78435091d8a561fe50321845194e220ce6f2.sock
[12:55:35.066] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/08/0h5fg9lx04jc571c1731g3kr0000gn/T/vscode-ssh-askpass-fae65875e910a64e81638c36e801817bd0689940.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","51909","-o","ConnectTimeout=15","coder-vscode--f0ssel--dev"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/f0ssel/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d6d3cfdd-1a5daa3a0231a0fbba4f14db7ec463cf99d7768e-0.107.0-tr/data.json"}
[12:55:35.066] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.znpVwvscOX/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/08/0h5fg9lx04jc571c1731g3kr0000gn/T/vscode-ssh-askpass-c38a78435091d8a561fe50321845194e220ce6f2.sock"}
[12:55:35.066] Spawned 31518
[12:55:35.129] > local-server-1> Running ssh connection command: "-v -T -D 51909 -o ConnectTimeout=15 coder-vscode--f0ssel--dev"
[12:55:35.130] > local-server-1> Spawned ssh, pid=31521
[12:55:35.132] stderr> OpenSSH_9.4p1, LibreSSL 3.3.6
[12:55:35.135] stderr> ssh: Could not resolve hostname coder-vscode--f0ssel--dev: nodename nor servname provided, or not known
[12:55:35.136] > local-server-1> ssh child died, shutting down
[12:55:35.137] Local server exit: 0
[12:55:35.138] Received install output: local-server-1> Running ssh connection command: "-v -T -D 51909 -o ConnectTimeout=15 coder-vscode--f0ssel--dev"
local-server-1> Spawned ssh, pid=31521
OpenSSH_9.4p1, LibreSSL 3.3.6
ssh: Could not resolve hostname coder-vscode--f0ssel--dev: nodename nor servname provided, or not known
local-server-1> ssh child died, shutting down

[12:55:35.139] Resolver error: Error: Could not resolve hostname
	at g.Offline (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:642341)
	at /Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:638178
	at t.handleInstallOutput (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:638725)
	at e (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:699953)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:721822
	at async t.withShowDetailsEvent (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:725481)
	at async /Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:696658
	at async C (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:694709)
	at async t.resolveWithLocalServer (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:696198)
	at async I (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:719045)
	at async t.resolve (/Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:722852)
	at async /Users/f0ssel/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.0/out/extension.js:2:906656
[12:55:35.142] ------

Video of experience:
https://github.com/coder/coder/assets/19379394/73cf3e79-c553-4e90-b63e-4d9cfa43c8e7

@cdr-bot cdr-bot bot added the bug label Nov 27, 2023
@matifali
Copy link
Member

matifali commented Nov 27, 2023

To add more context, we have two methods to add a VS Code Desktop button.

  1. The built-in Integration that is on by default and can be turned off with,
resource "coder_agent" "dev" {
  display_apps {
    vscode = false
  }
}
  1. The VS Code Desktop module from coder registry. https://registry.coder.com/vscode-desktop

We are using the module at dev.coder.com template.

@kylecarbs
Copy link
Member

@f0ssel can you add your SSH config file contents in here?

@kylecarbs
Copy link
Member

I'm confident it's due to some strange config file not found issue.

@f0ssel
Copy link
Contributor Author

f0ssel commented Nov 27, 2023

You got it dude. 👍

Host github.com
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519

Like I said, brand new laptop so I haven't tinkered much at all yet. Not to say that the new MacOS doesn't do anything funky somewhere.

@spikecurtis
Copy link
Contributor

Ok, well clearly, it's looking for Config that ain't there: coder-vscode--f0ssel--dev

What's responsible for adding VS Code entries in the config file? Our plugin?

@spikecurtis
Copy link
Contributor

looks like coder/vscode-coder#159 @code-asher

@code-asher
Copy link
Member

code-asher commented Nov 28, 2023

Looks like the URL is missing from the connection string, so it defaults to localhost, the queries fail (the plugin grabs a bunch of things before writing out the SSH entry like the version, workspace status, downloads the binary, etc), and the configuration is aborted. I have two PRs up, one to add the missing URL query param to the VS Code desktop module, and another to handle a missing URL gracefully in the plugin by asking the user to input it.

However, there could be another bug. coder/vscode-coder#159 does not mention localhost and for a while I was able to reproduce another bug where the remote SSH plugin appeared to start connecting before the Coder plugin was finished configuring SSH, which I think might be what happened there. Subsequent attempts work since the config is written at that point. Unfortunately I can no longer reproduce this one, but I will keep looking into it.

@code-asher code-asher self-assigned this Nov 29, 2023
@matifali matifali added the s2 Broken use cases or features (with a workaround). Only humans may set this. label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s2 Broken use cases or features (with a workaround). Only humans may set this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants