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

Uncaught Exception for /Me API #946

Open nsenno-dbr opened 5 months ago

nsenno-dbr commented 5 months ago

Description I was given the following error message when attempting to validate my DAB. I was able to authenticate. Note that THE ISSUE WENT AWAY AFTER AUTHENTICATING databricks auth login. I'm still opening this issue because I believe there is an issue with the message that prompts the user to authenticate:

Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me
> * Host:
> * Accept: application/json
> * Authorization: REDACTED
> * User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat
< HTTP/2.0 403 Forbidden
< * Content-Length: 52
< * Content-Type: application/json; charset=utf-8
< * Date: Wed, 12 Jun 2024 03:51:20 GMT
< * Server: databricks
< * Vary: Accept-Encoding
< * X-Databricks-Reason-Phrase: Invalid access token.
< {
<   "error_code": 403,
<   "message": "Invalid access token."
< }

Reproduction databricks bundle validate (presumably while being unauthenticated

Expected behavior I am prompted to log in using the traditional Databricks CLI authentication

Is it a regression? Haven't tried other versions though I was getting the correct message to authenticate previously. Saw the new error message and thought I'd report here

Debug Logs

22:54:05 INFO start pid=11540 version=0.219.0 args="databricks, bundle, validate, --debug" 22:54:05 DEBUG Found bundle root at /Users/nick.senno/Documents/Clients/a16z/repos/datascience_monorepo/it/it_chatbot (file /Users/nick.senno/Documents/Clients/a16z/repos/datascience_monorepo/it/it_chatbot/databricks.yml) pid=11540 22:54:05 DEBUG Apply pid=11540 mutator=load 22:54:05 INFO Phase: load pid=11540 mutator=load 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=EntryPoint 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=scripts.preinit 22:54:05 DEBUG No script defined for preinit, skipping pid=11540 mutator=load mutator=seq mutator=scripts.preinit 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=ProcessRootIncludes 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=ProcessRootIncludes mutator=seq 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=ProcessRootIncludes mutator=seq mutator=ProcessInclude(../../bundle.targets.yml) 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=VerifyCliVersion 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=EnvironmentsToTargets 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=InitializeVariables 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=DefineDefaultTarget(default) 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=LoadGitDetails 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=SelectDefaultTarget 22:54:05 DEBUG Apply pid=11540 mutator=load mutator=seq mutator=SelectDefaultTarget mutator=SelectTarget(dev) 22:54:05 DEBUG Apply pid=11540 mutator= 22:54:05 DEBUG Apply pid=11540 mutator=initialize 22:54:05 INFO Phase: initialize pid=11540 mutator=initialize 22:54:05 DEBUG Apply pid=11540 mutator=initialize mutator=seq 22:54:05 DEBUG Apply pid=11540 mutator=initialize mutator=seq mutator=RewriteSyncPaths 22:54:05 DEBUG Apply pid=11540 mutator=initialize mutator=seq mutator=MergeJobClusters 22:54:05 DEBUG Apply pid=11540 mutator=initialize mutator=seq mutator=MergeJobTasks 22:54:05 DEBUG Apply pid=11540 mutator=initialize mutator=seq mutator=MergePipelineClusters 22:54:05 DEBUG Apply pid=11540 mutator=initialize mutator=seq mutator=InitializeWorkspaceClient 22:54:05 DEBUG Loading profile a16z because of host match pid=11540 22:54:05 DEBUG Apply pid=11540 mutator=initialize mutator=seq mutator=PopulateCurrentUser 22:54:05 DEBUG Loading profile a16z because of host match pid=11540 22:54:05 DEBUG non-retriable error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me
> * Host:
> * Accept: application/json
> * Authorization: REDACTED
> * User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat
< HTTP/2.0 403 Forbidden
< * Content-Length: 52
< * Content-Type: application/json; charset=utf-8
< * Date: Wed, 12 Jun 2024 03:54:05 GMT
< * Server: databricks
< * Vary: Accept-Encoding
< * X-Databricks-Reason-Phrase: Invalid access token.
< {
<   "error_code": 403,
<   "message": "Invalid access token."
< }
``` pid=11540 mutator=initialize mutator=seq mutator=PopulateCurrentUser sdk=true
22:54:05 DEBUG GET /api/2.0/preview/scim/v2/Me
< HTTP/2.0 403 Forbidden
< {
<   "error_code": 403,
<   "message": "Invalid access token."
< } pid=11540 mutator=initialize mutator=seq mutator=PopulateCurrentUser sdk=true
22:54:05 ERROR Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    22:54:05 ERROR Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    22:54:05 ERROR Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    22:54:05 DEBUG Apply pid=11540 mutator=validate
    22:54:05 DEBUG ApplyReadOnly pid=11540 mutator=validate mutator (read-only)=parallel
    22:54:05 DEBUG ApplyReadOnly pid=11540 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:validate_sync_patterns
    22:54:05 DEBUG ApplyReadOnly pid=11540 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:job_cluster_key_defined
    22:54:05 DEBUG ApplyReadOnly pid=11540 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync
    22:54:05 DEBUG non-retriable error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    22:54:05 DEBUG GET /api/2.0/preview/scim/v2/Me
    < HTTP/2.0 403 Forbidden
    < {
    <   "error_code": 403,
    <   "message": "Invalid access token."
    < } pid=11540 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync sdk=true
    22:54:05 ERROR Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    22:54:05 ERROR Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    22:54:05 ERROR Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    Error: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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/preview/scim/v2/Me

  • Host:
  • Accept: application/json
  • Authorization: REDACTED
  • User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat < HTTP/2.0 403 Forbidden < Content-Length: 52 < Content-Type: application/json; charset=utf-8 < Date: Wed, 12 Jun 2024 03:54:05 GMT < Server: databricks < Vary: Accept-Encoding < X-Databricks-Reason-Phrase: Invalid access token. < { < "error_code": 403, < "message": "Invalid access token." < }
    
    22:54:05 ERROR failed execution pid=11540 exit_code=1 error="unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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:\n```\nGET /api/2.0/preview/scim/v2/Me\n> * Host: \n> * Accept: application/json\n> * Authorization: REDACTED\n> * User-Agent: cli/0.219.0 databricks-sdk-go/0.39.0 go/1.21.9 os/darwin cmd/bundle_validate auth/pat\n< HTTP/2.0 403 Forbidden\n< * Content-Length: 52\n< * Content-Type: application/json; charset=utf-8\n< * Date: Wed, 12 Jun 2024 03:54:05 GMT\n< * Server: databricks\n< * Vary: Accept-Encoding\n< * X-Databricks-Reason-Phrase: Invalid access token.\n< {\n<   \"error_code\": 403,\n<   \"message\": \"Invalid access token.\"\n< }\n```"

Other Information

Additional context Add any other context about the problem here.

tusharm commented 5 months ago

I get the same issue when using databricks-terraform-provider:

│ Error: cannot create service principal: unexpected error handling request: json: cannot unmarshal number into Go struct field APIErrorBody.error_code of type string. 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:

│ POST /api/2.0/preview/scim/v2/ServicePrincipals
│ > * Host:
│ > * Accept: application/json
│ > * Authorization: REDACTED
│ > * Content-Type: application/scim+json; charset=utf-8
│ > * Traceparent: 00-ab2295e010eb060d7e16f8e084c0c32e-946c9df217e181a7-01
│ > * User-Agent: databricks-tf-provider/1.47.0 databricks-sdk-go/0.41.0 go/1.21.10 os/darwin terraform/1.8.5 resource/service_principal auth/pat
│ > {
│ >   "active": true,
│ >   "displayName": "data-core-dev-ws-fivetran-sp",
│ >   "entitlements": [
│ >     {
│ >       "value": "databricks-sql-access"
│ >     }
│ >   ],
│ >   "schemas": [
│ >     "urn:ietf:params:scim:schemas:core:2.0:ServicePrincipal"
│ >   ]
│ > }
│ < HTTP/2.0 403 Forbidden
│ < * Content-Length: 70
│ < * Content-Type: application/json; charset=utf-8
│ < * Date: Tue, 18 Jun 2024 03:22:46 GMT
│ < * Server: databricks
│ < * Vary: Accept-Encoding
│ < * X-Databricks-Reason-Phrase: Invalid access to Org: ***************
│ < {
│ <   "error_code": 403,
│ <   "message": "Invalid access to Org: ***********"
│ < }

OS: MacOS Sonoma 14.4.1