databricks/databricks-vscode

[BUG] The extension does not support proxies

geoffdavey opened this issue · 3 comments

Describe the bug
The extension cannot connect to workspaces that are being accessed via a proxy.

To Reproduce
Steps to reproduce the behavior:

  1. Work for a company that has put a proxy between the developer and Databricks
  2. Try to connect to Databricks with the extension
  3. See error "Connection using "Profile 'DEFAULT'" failed with error: "Socket is closed".""

I debugged the extension and saw that the HTTP code 407, Proxy Authentication Required, is not handled correctly in the fetch function.

System information:

  1. Paste the output ot the Help: About command (CMD-Shift-P).

Version: 1.79.2 (user setup)
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:57:04.379Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19045

  1. Databricks Extension Version:

v1.0.0

Databricks Extension Logs

{"error":{"code":"ERR_SOCKET_CLOSED","message":"Socket is closed","stack":"Error: Socket is closed\n\tat new NodeError (node:internal/errors:387:5)\n\tat Socket._writeGeneric (node:net:864:8)\n\tat Socket._write (node:net:886:8)\n\tat doWrite (node:internal/streams/writable:410:12)\n\tat clearBuffer (node:internal/streams/writable:571:7)\n\tat Writable.uncork (node:internal/streams/writable:350:7)\n\tat ClientRequest._flushOutput (node:_http_outgoing:1049:10)\n\tat ClientRequest._flush (node:_http_outgoing:1018:22)\n\tat onSocketNT (node:_http_client:869:9)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:84:21)","toString":{}},"level":"error","logger":"Extension","message":"Can't login to Databricks: Socket is closed","timestamp":1688545736411}

Additional context

I have only attempted to reproduce this on Windows.

Note: the Databricks CLI does seem to support proxies, as running

.\databricks.exe --log-level trace current-user me

works just fine here! I've also only tested the Databricks CLI on Windows.

@geoffdavey are you using env vars like HTTPS_PROXY to configure your proxy or some other method?

@fjakobs did we not start respecting proxy env vars?