databricks / databricks-sdk-go

Databricks SDK for Go
https://docs.databricks.com/dev-tools/sdk-go.html
Apache License 2.0
51 stars 42 forks source link

[ISSUE] databricks account workspaces list error #1024

Open DejiCodes opened 2 months ago

DejiCodes commented 2 months ago

Description Databricks CLI workspaces doesn't work

Reproduction databricks account workspaces list

Error: unexpected error handling request: invalid character '<' looking for beginning of value

Request log:

GET /login?account_id=25523383-f348-4824-9d4a-b13f0dc4faa0&next_url=/api/2.0/accounts/25523383-f348-4824-9d4a-b13f0dc4faa0/workspaces
> * Host: 
> * Accept: application/json
> * Authorization: REDACTED
> * Referer: https://accounts.azuredatabricks.net/api/2.0/accounts/25523383-f348-4824-9d4a-b13f0dc4faa0/workspaces
> * Traceparent: 00-9375aa662969755dae98c95b6756b3c2-c110cc6baaf6402d-01
> * User-Agent: cli/0.226.0 databricks-sdk-go/0.44.0 go/1.22.6 os/darwin cmd/account_workspaces_list auth/databricks-cli
< HTTP/2.0 200 OK
< * Cache-Control: no-cache, no-store, must-revalidate
< * Content-Type: text/html; charset=utf-8
< * Date: Thu, 22 Aug 2024 10:00:12 GMT
< * Server: databricks
< * Set-Cookie: enable-armeria-server-for-ui-flags=false; Max-Age=1800; Expires=Thu, 22 Aug 2024 10:30:12 GMT; Secure; HTTPOnly; SameSite=Strictenable-armeria-workspace-server-for-ui-flags=false; Max-Age=1800; Expires=Thu, 22 Aug 2024 10:30:12 GMT; Secure; HTTPOnly; SameSite=Strict
< * Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< * X-Content-Type-Options: nosniff
< * X-Request-Id: c15d334c-9352-48de-a1ab-109bc8bc3b81
< * X-Ui-Svc: true
< <!doctype html>
< <html lang="en">
<  <head>
<   <meta charset="utf-8">
<   <meta name="viewport" content="width=device-width,initial-scale=1">
<   <meta name="theme-color" content="#000000">
<   <meta name="description" content="Databricks Sign in">
<   <title>Databricks - Sign in</title>
<   <script>window.__DATABRICKS_CONFIG__={"isCuttingEdge":false,"publicPath":{"accounts-console":"https://databricks-ui-assets.azureedge.net/"}}</script>
<   <link rel="icon" href="https://databricks-ui-assets.azureedge.net/favicon.ico">
<   <script defer src="https://databricks-ui-assets.azureedge.net/static/js/8843.9334ce07.js"></script>
<   <script defer src="https://databricks-ui-assets.azureedge.net/static/js/802.55bbb00f.js"></script>
<   <script defer src="https://databricks-ui-assets.azureedge.net/static/js/9806.4bdefc97.js"></script>
<   <script>
<   function setNoCdnAndReload() {
<       document.cookie = `x-databricks-cdn-inaccessible=true; path=/; max-age=86400`;
<       const metric = 'cdnFallbackOccurred';
<       const browserUserAgent = navigator.userAgent;
<       const browserTabId = window.browserTabId;
<       const performanceEntry = performance.getEntriesByType('resource').filter(e => e.initiatorType === 'script').slice(-1)[0]
<       sessionStorage.setItem('databricks-cdn-fallback-telemetry-key', JSON.stringify({ tags: { browserUserAgent, browserTabId }, performanceEntry}));
<       window.location.reload();
<   }
< </script>
<   <script>
<   // Set a manual timeout for dropped packets to CDN
<   function loadScriptWithTimeout(src, timeout) {
<      return new Promise((resolve, reject) => {
<         const script = document.createElement('script');
<           script.defer = true;
<           script.src = src;
<           script.onload = resolve;
<           script.onerror = reject;
<           document.head.appendChild(script);
<           setTimeout(() => {
<               reject(new Error('Script load timeout'));
<           }, timeout);
<       });
<   }
<   loadScriptWithTimeout('https://databricks-ui-assets.azureedge.net/static/js/login.10991e62.js', 10000).catch(setNoCdnAndReload);
< </script>
<   <link href="https://databricks-ui-assets.azureedge.net/static/css/8843.013d6ea4.css" rel="stylesheet">
<   <link href="https://databricks-ui-assets.azureedge.net/static/css/9806.ec03b64f.css" rel="stylesheet">
<   <link href="https://databricks-ui-assets.azureedge.net/static/css/login.5a13953a.css" rel="stylesheet">
<  </head>
<  <body>
<   <noscript>
<    You need to enable JavaScript to run this app.
<   </noscript>
<   <div id="login"></div>
<   <script>const telemetryEndpoint="/telemetry-unauth?t=",uiModuleName="accountsConsoleLogin";function shouldIgnoreError(e){return!1}function generateUuidV4(){const e=window.crypto?.randomUUID?.();return e||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)}))}function networkConnectivityTags(){const e=window.navigator.onLine,n=window.navigator.connection?.rtt??-1,t=window.navigator.connection?.downlink??-1;return{browserNavigatorOnline:e,browserConnectionEstimatedRtt:n,browserConnectionEstimatedDownlink:t,browserConnected:e&&n>0&&t>0}}function createTelemetryRequestBody(e,n={},t=null){const o=Math.round(Date.now()/1e3),r={eventId:generateUuidV4(),metric:e,tags:{...n,...networkConnectivityTags(),browserTabId:window.browserTabId,browserUserAgent:navigator.userAgent},ts:o};return t&&(r.blob=t),JSON.stringify({uploadTime:o,items:[JSON.stringify(r)]})}function recordTelemetry(e,n={},t=""){const o={method:"POST",credentials:"include",body:createTelemetryRequestBody(e,n,t),headers:{"Content-Type":"application/json","X-Databricks-Org-Id":"AC"}};fetch(telemetryEndpoint+Date.now(),o)}window.__databricks_networkConnectivityTags=networkConnectivityTags,Object.defineProperty(window,"browserTabId",{value:generateUuidV4()}),window.recordTelemetry=recordTelemetry,recordTelemetry("uiInit",{uiModule:uiModuleName,eventId:"init",eventClientSource:uiModuleName,eventType:"init"});let logCount=0;function error_handler(e,n,t,o,r){logCount++>4||shouldIgnoreError(e)||recordTelemetry("uncaughtJsException",{eventType:"jsExceptionV3",jsExceptionMessage:e,jsExceptionSource:n,jsExceptionLineno:t,jsExceptionColno:o,jsExceptionBeforeInit:!0},r&&r.stack&&r.stack.toString())}function sendBeaconOnPageExit(e){if(navigator.sendBeacon){const n=e&&e.type||"unknown",t=(Math.round(Date.now()/1e3),createTelemetryRequestBody("uiInit",{eventType:"pageExitBeforeAppInitComplete",eventName:n,eventClientSource:uiModuleName}));navigator.sendBeacon(telemetryEndpoint+Date.now(),t)}}window.onerror=error_handler,window.onunhandledrejection=function(e){error_handler(String(e.reason),null,null,null,e.reason)},window.addEventListener("beforeunload",sendBeaconOnPageExit),window.addEventListener("unload",sendBeaconOnPageExit),window.addEventListener("pagehide",sendBeaconOnPageExit),window.cleanupAfterAppInit=()=>{window.removeEventListener("beforeunload",sendBeaconOnPageExit),window.removeEventListener("unload",sendBeaconOnPageExit),window.removeEventListener("pagehide",sendBeaconOnPageExit)}</script>
<  </body>
< </html>

Expected behavior Running databricks account workspaces list should list results

Debug Logs 11:44:26 INFO start pid=83274 version=0.226.0 args="databricks, account, workspaces, list, --debug" 11:44:26 DEBUG Loading accounts profile from /Users/myuser/.databrickscfg pid=83274 sdk=true 11:44:26 INFO Ignoring pat auth, because databricks-cli is preferred pid=83274 sdk=true 11:44:26 INFO Ignoring basic auth, because databricks-cli is preferred pid=83274 sdk=true 11:44:26 INFO Ignoring oauth-m2m auth, because databricks-cli is preferred pid=83274 sdk=true 11:44:26 DEBUG Running command: /opt/homebrew/Cellar/databricks/0.226.0/bin/databricks auth token --host https://accounts.azuredatabricks.net --account-id 25523383-f348-4824-9d4a-b13f0dc4faa0 pid=83274 sdk=true 11:44:26 INFO Refreshed OAuth token from Databricks CLI, expires on 2024-08-22 12:00:04.750233 +0100 BST pid=83274 sdk=true 11:44:26 DEBUG Using Databricks CLI authentication with Databricks OAuth tokens pid=83274 sdk=true 11:44:26 DEBUG Running command: /opt/homebrew/Cellar/databricks/0.226.0/bin/databricks auth token --host https://accounts.azuredatabricks.net --account-id 25523383-f348-4824-9d4a-b13f0dc4faa0 pid=83274 sdk=true 11:44:26 INFO Refreshed OAuth token from Databricks CLI, expires on 2024-08-22 12:00:04.750233 +0100 BST pid=83274 sdk=true 11:44:26 DEBUG GET /api/2.0/accounts/25523383-f348-4824-9d4a-b13f0dc4faa0/workspaces

Other Information

krupakar1329 commented 2 months ago

Similar issue https://github.com/databricks/terraform-provider-databricks/issues/3934

dsfrederic-cgk commented 2 months ago

Same issue here!

krupakar1329 commented 2 months ago

@tanmay-db @mgyucht for visibility

awbarbeau commented 2 months ago

Started seeing this issue at ~2pm central on August 21st.

awbarbeau commented 2 months ago

Seeing Terraform pipelines that call this SDK succeed as of ~6pm CST on August 22nd.

bentleysj commented 1 month ago

I've been having this since approximately 6pm UTC 25th September. Using the latest (1.52.0) TF provider - has it reappeared for anyone else?

krupakar1329 commented 1 month ago

1048 https://github.com/databricks/terraform-provider-databricks/issues/3934#issuecomment-2376723128