paiqo / Databricks-VSCode

VSCode extension to work with Databricks
GNU General Public License v3.0
123 stars 27 forks source link

Can't connect with the Databricks extension #189

Closed ilia-db closed 1 month ago

ilia-db commented 6 months ago

Hey, I'm one of the developers of the Databricks extension.

We are preparing to launch a v2 version of the extension and had to double check that the public API works (since Databricks Power Tools can use our public API as one way of setting up connections). Turns out that event with existing v1.3 version of our extension the Power Tools fail to setup connection with: ERROR: Connection 'Databricks Extension' is not valid!.

I also see these exceptions from uncaught promises in the debug console (not sure if they are related though):

rejected promise not handled within 1 second: TypeError: Cannot read properties of undefined (reading 'length')
stack trace: TypeError: Cannot read properties of undefined (reading 'length')
    at d.get ClusterDetails [as ClusterDetails] (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:54806)
    at new d (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:53113)
    at Function.createKernels (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:67560)
    at a.initialize (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:99295)
    at Function.initialize (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:19046)
    at /Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:265025
    at d.h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:186866)
    at e.activate (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:265354)
    at a.n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:142:6237)
    at a.m (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:142:6200)
    at a.l (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:142:5657)
extensionHostProcess.js:146
rejected promise not handled within 1 second: Error: notebook controller with id 'databricks_extension_generic-jupyter-notebook' ALREADY exist
extensionHostProcess.js:146
stack trace: Error: notebook controller with id 'databricks_extension_generic-jupyter-notebook' ALREADY exist
    at r.createNotebookController (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:213797)
    at Object.createNotebookController (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:162:45973)
    at new d (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:52895)
    at Function.createKernels (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:67560)
    at a.initialize (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:99295)
    at t.DatabricksConnectionTreeProvider.refresh (/Users/ilia.babanov/.vscode/extensions/paiqo.databricks-vscode-2.2.4/dist/node/extension.js:2:115132)
    at d.h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:186866)

Relevant PR on our side: https://github.com/databricks/databricks-vscode/pull/1217

gbrueckl commented 6 months ago

Hi @ilia-db,

so we basically call login() without any parameters at the moment relying on your extension to handle the login of the user. Once logged in, we call ApiClient.config.authenticate() (https://github.com/paiqo/Databricks-VSCode/blob/master/src/vscode/treeviews/connections/DatabricksConnectionManagerDatabricks.ts#L122) which currently fails with:

"TypeError: headers.set is not a function
    at Config3.auth (c:\\Users\\GerhardBrueckl\\.vscode\\extensions\\databricks.databricks-1.3.0-win32-x64\\out\\extension.js:2703:17)
    at Config3.authenticate (c:\\Users\\GerhardBrueckl\\.vscode\\extensions\\databricks.databricks-1.3.0-win32-x64\\out\\extension.js:23144:9)
    at DatabricksConnectionManagerDatabricks.getAuthorizationHeaders (d:\\SourceControl\\paiqo\\Databricks-VSCode\\dist\\node\\webpack:\\databricks-vscode\\src\\vscode\\treeviews\\connections\\DatabricksConnectionManagerDatabricks.ts:122:3)
    at Function.initialize (d:\\SourceControl\\paiqo\\Databricks-VSCode\\dist\\node\\webpack:\\databricks-vscode\\src\\databricksApi\\databricksApiService.ts:37:18)
    at DatabricksConnectionManagerDatabricks.activateConnection (d:\\SourceControl\\paiqo\\Databricks-VSCode\\dist\\node\\webpack:\\databricks-vscode\\src\\vscode\\treeviews\\connections\\DatabricksConnectionManager.ts:50:7)
    at DatabricksConnectionManagerDatabricks.initialize (d:\\SourceControl\\paiqo\\Databricks-VSCode\\dist\\node\\webpack:\\databricks-vscode\\src\\vscode\\treeviews\\connections\\DatabricksConnectionManagerDatabricks.ts:44:5)
    at Function.initialize (d:\\SourceControl\\paiqo\\Databricks-VSCode\\dist\\node\\webpack:\\databricks-vscode\\src\\ThisExtension.ts:123:4)
    at d:\\SourceControl\\paiqo\\Databricks-VSCode\\dist\\node\\webpack:\\databricks-vscode\\src\\extension.ts:200:30 
   at r.h (c:\\Users\\GerhardBrueckl\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\api\\node\\extensionHostProcess.js:153:189457)"

this used to work in the past (but I have to admit that this has not been tested again afterwards/within the last months)

ilia-db commented 6 months ago

Makes sense. I believe swapping an empty headers object with an empty map should solve that issue.

gbrueckl commented 1 month ago

I am quite sure this was fixed some time ago and is live already :)