microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.68k stars 296 forks source link

[Remote-SSH Bug]: v0.115.0 can't handle empty ssh config #10431

Closed JamyDev closed 2 weeks ago

JamyDev commented 3 weeks ago

Is there an existing issue for this bug?

9583

I have followed these troubleshooting steps

I have tried both values of the remote.SSH.useLocalServer setting

Expected Behavior

Remote-SSH connects successfully

Actual Behavior

Fails to connect, gives an error (see below)

Steps To Reproduce

echo "" > ~/.ssh/config on your machine (M1 MacBook in my case), try to connect to a remote SSH host. It will fail with the below error.

Image

Devtools logs below (truncated after the first retry)

 INFO Started local extension host with pid 15725.
log.ts:419  INFO Invoking resolveAuthority(ssh-remote)...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][0ms] obtaining proxy...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][0ms] invoking...
log.ts:439   ERR [LocalProcess0][resolveAuthority(ssh-remote,1)][12ms] returned an error TypeError: Cannot read properties of undefined (reading 'after')
    at w (vscode-file://vscode-app/Users/jamy/.vscode/extensions/ms-vscode-remote.remote-ssh-0.115.0/out/extension.js:2:447791)
    at $ (vscode-file://vscode-app/Users/jamy/.vscode/extensions/ms-vscode-remote.remote-ssh-0.115.0/out/extension.js:2:591885)
    at async O (vscode-file://vscode-app/Users/jamy/.vscode/extensions/ms-vscode-remote.remote-ssh-0.115.0/out/extension.js:2:591441)
    at async s.parseWithConfig (vscode-file://vscode-app/Users/jamy/.vscode/extensions/ms-vscode-remote.remote-ssh-0.115.0/out/extension.js:2:611272)
    at async _.resolve (vscode-file://vscode-app/Users/jamy/.vscode/extensions/ms-vscode-remote.remote-ssh-0.115.0/out/extension.js:2:838390)
    at async hB.$resolveAuthority (/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:118:19786)
log.ts:439   ERR resolveAuthority(ssh-remote) returned an error after 12 ms CodeExpectedError: Cannot read properties of undefined (reading 'after')
    at Hnt.qb (abstractExtensionService.ts:661:9)
    at async Hnt.pb (abstractExtensionService.ts:622:19)
    at async Hnt.Nb (nativeExtensionService.ts:363:22)
    at async Hnt.ib (abstractExtensionService.ts:452:31)
log.ts:439   ERR Error received from starting extension host (kind: Remote)
log.ts:439   ERR CodeExpectedError: Cannot read properties of undefined (reading 'after')
    at Hnt.qb (abstractExtensionService.ts:661:9)
    at async Hnt.pb (abstractExtensionService.ts:622:19)
    at async Hnt.Nb (nativeExtensionService.ts:363:22)
    at async Hnt.ib (abstractExtensionService.ts:452:31)
log.ts:439   ERR [remote-connection][attempt 1] An error occurred in initial connection! Will retry... Error:
log.ts:439   ERR CodeExpectedError: Cannot read properties of undefined (reading 'after')
    at Hnt.qb (abstractExtensionService.ts:661:9)
    at async Hnt.pb (abstractExtensionService.ts:622:19)
    at async Hnt.Nb (nativeExtensionService.ts:363:22)
    at async Hnt.ib (abstractExtensionService.ts:452:31)

On 0.107.x it connects just fine. Based on some devtools tracing, it happens during the $resolveAuthority call.

Remote-SSH output log:

[14:35:12.974] Log Level: 1
[14:35:12.988] VS Code version: 1.94.2
[14:35:12.988] Remote-SSH version: remote-ssh@0.115.0
[14:35:12.989] darwin arm64
[14:35:13.022] SSH Resolver called for "ssh-remote+jamy-2.<hostname>", attempt 1
[14:35:13.022] "remote.SSH.useLocalServer": false
[14:35:13.023] "remote.SSH.useExecServer": true
[14:35:13.023] "remote.SSH.showLoginTerminal": false
[14:35:13.023] "remote.SSH.remotePlatform": {"jamy-2.<hostname>":"linux"}
[14:35:13.023] "remote.SSH.path": undefined
[14:35:13.023] "remote.SSH.configFile": undefined
[14:35:13.023] "remote.SSH.useFlock": true
[14:35:13.023] "remote.SSH.lockfilesInTmp": false
[14:35:13.023] "remote.SSH.localServerDownload": auto
[14:35:13.023] "remote.SSH.remoteServerListenOnSocket": false
[14:35:13.023] "remote.SSH.showLoginTerminal": false
[14:35:13.023] "remote.SSH.defaultExtensions": []
[14:35:13.023] "remote.SSH.loglevel": 1
[14:35:13.023] "remote.SSH.maxReconnectionAttempts": 8
[14:35:13.023] "remote.SSH.enableDynamicForwarding": true
[14:35:13.023] "remote.SSH.enableRemoteCommand": false
[14:35:13.024] "remote.SSH.serverPickPortsFromRange": {}
[14:35:13.024] "remote.SSH.serverInstallPath": {}
[14:35:13.024] "remote.SSH.permitPtyAllocation": false
[14:35:13.024] "remote.SSH.preferredLocalPortRange: undefined
[14:35:13.024] "remote.SSH.useCurlAndWgetConfigurationFiles: false
joshspicer commented 2 weeks ago

Thanks, will be fixed in a pre-release build early next week