databricks / databricks-sdk-go

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

[ISSUE] Error: cannot read workspace conf: unexpected error handling request: invalid character 'S' looking for beginning of value. #892

Open gercograndia opened 5 months ago

gercograndia commented 5 months ago

Description When using the terraform databricks provider (version 1.39.0) we have quite regularly but not always this error popping up when planning or applying code. We have upgraded our databricks provider recently so I guess it is introduced in one of these later versions.

Seems related to issue #883 .

Reproduction Just using the databricks_workspace_conf resource

Expected behavior No error

Is it a regression? It is a new issue to us, so my take is that this is indeed a regression.

Other Information

Debug Logs Turning on the debug logs is a bit difficult when you don't know when the issue appears. But this is the already pretty verbose error message that you get:

│ Error: cannot read workspace conf: unexpected error handling request: invalid character 'S' looking for beginning of value. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log: │ │ GET /api/2.0/workspace-conf?keys=enableDbfsFileBrowser,enableDcs,enforceWorkspaceViewAcls,enableIpAccessLists,enableResultsDownloading,enableUploadDataUis,enableWebTerminal,enableExportNotebook,storeInteractiveNotebookResultsInCustomerAccount,enforceClusterViewAcls,enableJobViewAcls │ > * Host: │ > * Accept: application/json │ > * Authorization: REDACTED │ > * User-Agent: databricks-tf-provider/1.39.0 databricks-sdk-go/0.37.0 go/1.21.8 os/darwin terraform/1.5.7 resource/workspace_conf auth/azure-cli │ > * X-Databricks-Azure-Sp-Management-Token: eyJ0eXAiOiJKV1QiLCJhbGc... (1086 more bytes) │ > * X-Databricks-Azure-Workspace-Resource-Id: /subscriptions/xxxxxx/resourceGroups/xxxxxxxx/providers/Microsoft.Databricks/workspaces/xxxxxx │ < HTTP/2.0 400 Bad Request │ < * Content-Type: application/json │ < * Date: Wed, 17 Apr 2024 13:36:52 GMT │ < * Server: databricks │ < * Strict-Transport-Security: max-age=31536000; includeSubDomains; preload │ < * Vary: Accept-Encoding │ < * X-Content-Type-Options: nosniff │ < * X-Databricks-Org-Id: 67013894097440 │ < Status: 400 │ < Description: Decoder failure │ < │ │ │ with module.dbx_ws_conf[0].databricks_workspace_conf.this, │ on ../../core/databricks/modules/workspace-config/main.tf line 3, in resource "databricks_workspace_conf" "this": │ 3: resource "databricks_workspace_conf" "this" {

q-yusufmahtab commented 3 weeks ago

We are also seeing this on provider version 1.51.0 with a different invalid character in the error and a different HTTP error code:

[2024-09-15T20:26:54.951Z] databricks_workspace_conf.databricks_workspace_config[0]: Refreshing state... [id=_]
...

[2024-09-15T20:27:00.116Z] │ Error: cannot read workspace conf: unexpected error handling request: invalid character 'U' looking for beginning of value. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log:
[2024-09-15T20:27:00.117Z] │ ```
[2024-09-15T20:27:00.117Z] │ GET /api/2.0/workspace-conf?keys=enableIpAccessLists
[2024-09-15T20:27:00.117Z] │ > * Host: 
[2024-09-15T20:27:00.117Z] │ > * Accept: application/json
[2024-09-15T20:27:00.117Z] │ > * Authorization: REDACTED
[2024-09-15T20:27:00.117Z] │ > * Traceparent: 00-58c04a939ee49142132d3033e5183b28-1db21ad4a04dfbd5-01
[2024-09-15T20:27:00.117Z] │ > * User-Agent: databricks-tf-provider/1.51.0 databricks-sdk-go/0.45.0 go/1.22.6 os/linux terraform/1.4.7 resource/workspace_conf auth/azure-cli cicd/jenkins
[2024-09-15T20:27:00.117Z] │ > * X-Databricks-Azure-Sp-Management-Token: [REDACTED]
[2024-09-15T20:27:00.117Z] │ < HTTP/2.0 403 Forbidden
[2024-09-15T20:27:00.117Z] │ < * Content-Length: 20
[2024-09-15T20:27:00.118Z] │ < * Content-Type: text/html; charset=utf-8
[2024-09-15T20:27:00.118Z] │ < * Date: Sun, 15 Sep 2024 20:26:56 GMT
[2024-09-15T20:27:00.118Z] │ < * Server: databricks
[2024-09-15T20:27:00.118Z] │ < * X-Request-Id: 5afe391c-a90c-90e4-91b5-5d5d41d38dbe
[2024-09-15T20:27:00.118Z] │ < User not authorized.
[2024-09-15T20:27:00.118Z] │ ```
[2024-09-15T20:27:00.118Z] │ 
[2024-09-15T20:27:00.118Z] │   with databricks_workspace_conf.databricks_workspace_config[0],
[2024-09-15T20:27:00.118Z] │   on databricks.tf line 115, in resource "databricks_workspace_conf" "databricks_workspace_config":
[2024-09-15T20:27:00.118Z] │  115: resource "databricks_workspace_conf" "databricks_workspace_config" {

Out configuration for the resource is:

resource "databricks_workspace_conf" "databricks_workspace_config" {
  count = local.create_databricks_workspace ? 1 : 0
  custom_config = {
    "enableIpAccessLists" : true
  }
  depends_on = [azurerm_databricks_workspace.databricks_workspace]
}