databricks/databricks-vscode

Can't login to Databricks: fetch failed

Closed this issue · 11 comments

Describe the bug
After the updating to 1.2.6 (and later to 1.2.7) I cannot connect to Remote Databricks cluster, receiving an error "Connection using "Profile 'DEFAULT'" failed with error: "fetch failed". My coworkers also have the same problem.

Reinstalling or downgrading (both VS Code and DBX Extension) did not help. URL and token provided in .databrickscfg are correct. My .databrickscfg is located in home directory of WSL.

System information:

  1. VS Code Version: 1.87.0-insider (user setup)
    Commit: c11a2dd4d52e38cb92b8c464f47a7b02bb7c8762
    Date: 2024-02-24T01:20:40.384Z
    Electron: 27.3.2
    ElectronBuildId: 26836302
    Chromium: 118.0.5993.159
    Node.js: 18.17.1
    V8: 11.8.172.18-electron.0
    OS: Windows_NT x64 10.0.22621
  2. Databricks Extension Version - 1.2.7

Thank you in advance for any help

Hi @poghostick. Are you using a proxy? If yes, how are you setting it up (are you exporting http_proxy environment variable maybe or adding it to a vscode config?).

Also, we noticed you are using VS Code insiders. It might be completely unrelated, but insiders is not really stable, so you might want to switch to stable version.

HI Kartik,

Thanks a lot for the quick reply! So, I tried both "env | grep -i proxy" in the WSL terminal and "netsh winhttp show proxy" in the Windows command prompt, but no proxy turned up with these commands. Any chance there might still be a proxy even if these commands draw a blank?

About the second thing, the bug first appeared when I was using VS Code. I gave it a reinstall, but the bug didn't disappear. Eventually, replaced it out with VS Code Insiders, but it didn't solve anything.

Thanks for your help!

Looks like it has something to do with issuer certificate. Here is the output from sdk-and-extension-logs.json.

{"error":{"cause":{"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"},"message":"fetch failed","stack":"TypeError: fetch failed\n\tat fetch2 (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:19803:17)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async fn (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:20127:26)\n\tat async retry3 (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:1735:20)\n\tat async ApiClient8.request (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:20113:30)\n\tat async CurrentUserService._me (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:48406:16)\n\tat async CurrentUserService.me (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:48414:16)\n\tat async _DatabricksWorkspace.load (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:132510:16)\n\tat async ConnectionManager._login (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:132769:35)\n\tat async ConnectionManager.login (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:132727:7)\n\tat async ConnectionManager.configureWorkspace (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:132905:5)\n\tat async ConnectionCommands.configureWorkspaceCommand (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:131091:5)\n\tat async ConnectionCommands. (/home/t383686j/.vscode-server-insiders/extensions/databricks.databricks-1.2.7/out/extension.js:137250:16)\n\tat async u.h (/home/t383686j/.vscode-server-insiders/bin/c11a2dd4d52e38cb92b8c464f47a7b02bb7c8762/out/vs/workbench/api/node/extensionHostProcess.js:150:184946)"},"level":"error","logger":"Extension","message":"Can't login to Databricks: fetch failed","timestamp":1708958089449}

If this is the case, would you happen to know whom I should contact to grant us certificate? Thanks

Looks like it has something to do with issuer certificate. Here is the output from sdk-and-extension-logs.json.

Aah. This does seem like there is a proxy somewhere on your network, which is mediating SSL. Since the setups are normally varied, you will need to ask someone who knows about your particular setup for the certificates.

Once you get that, you might want to add the certificates to the system keystore and try again.

cc @mgyucht

FYI, the error disappeared when I downgraded Databricks extension all the way back to the version 1.2.1.

I'm encountering a similar problem. My company uses ZScaler and setting environment variables like REQUESTS_CA_BUNDLE, AWS_CA_BUNDLE etc. usually solves certificate issues in other tools. I've tried simply setting the NODE_EXTRA_CA_CERTS environment variable but it does not work in this case. However, setting both NODE_EXTRA_CA_CERTS and installing the Node Extra CA Certs extension in VSCode worked for me.

@pchoinsk could you also try https://marketplace.visualstudio.com/items?itemName=ukoloff.win-ca ? We are planning to do something like this natively in the extensions.

@pchoinsk could you also try https://marketplace.visualstudio.com/items?itemName=ukoloff.win-ca ? We are planning to do something like this natively in the extensions.

Hi @fjakobs. I'm on Macbook so win-ca won't work for me.

We have a tentative fix merged. This will go out in the next release.

Hi. We just released a new version (v1.3.0) with the fix. Can you try it and let us know if you still face the issue?

The extension should now pickup certificates from your system keystore. You can also disable ssl from VS Code configs, although we don't recommend doing that and rather adding the certificates to the keystore.

Hi. It works fine on Mac without the need to install additional extensions like Node Extra CA Certs.