Skip to content

[ISSUE] CurrentUserAPI's me() fails in serving endpoint #1408

@WebSchw

Description

@WebSchw

Description
I have a serving endpoint that is (in part) writing data to a table in the catalog. For authentication I use obo-auth and want to log the current user for debugging purposes. Retrieving the user via client.current_user.me() throws the Exception.

Reproduction
Have a serving endpoint that does:

_client = WorkspaceClient(credentials_strategy=ModelServingUserCredentials())
_client.current_user.me()

Expected behavior
Return the current user

Debug Logs

[887s7] File "/model/code/trans_agent/services/table_writer.py", line 50, in execute_statement
[887s7] client = _get_client()
[887s7] File "/model/code/trans_agent/services/table_writer.py", line 32, in _get_client
[887s7] logger.debug("Logged in as user:", _client.current_user.me())
[887s7] File "/opt/conda/envs/mlflow-env/lib/python3.10/site-packages/databricks/sdk/service/iam.py", line 3274, in me
[887s7] res = self._api.do("GET", "/api/2.0/preview/scim/v2/Me", headers=headers)
[887s7] File "/opt/conda/envs/mlflow-env/lib/python3.10/site-packages/databricks/sdk/core.py", line 85, in do
[887s7] return self._api_client.do(
[887s7] File "/opt/conda/envs/mlflow-env/lib/python3.10/site-packages/databricks/sdk/_base_client.py", line 196, in do
[887s7] response = call(
[887s7] File "/opt/conda/envs/mlflow-env/lib/python3.10/site-packages/databricks/sdk/retries.py", line 57, in wrapper
[887s7] raise err
[887s7] File "/opt/conda/envs/mlflow-env/lib/python3.10/site-packages/databricks/sdk/retries.py", line 36, in wrapper
[887s7] return func(*args, **kwargs)
[887s7] File "/opt/conda/envs/mlflow-env/lib/python3.10/site-packages/databricks/sdk/_base_client.py", line 298, in _perform
[887s7] raise error from None
[887s7] databricks.sdk.errors.platform.PermissionDenied: unable to parse response. This is likely a bug in the Databricks SDK for Python or the underlying 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
[887s7] > * User-Agent: unknown/0.0.0 databricks-sdk-py/0.57.0 python/3.10.12 os/linux auth/model_serving_user_credentials
[887s7] > * Accept-Encoding: gzip, deflate
[887s7] > * Accept: application/json
[887s7] > * Connection: keep-alive
[887s7] > * Authorization: Bearer eyJraWQiOiJjMGQ2YzQ2MTA4NWVmY2E1YTgzYTMxNzI2ZDQ2ZmMzN2QxNmMwYzY4NWQwNDRhMTJhNTUxNjhhOGM3MzZkM2U2IiwidHlwIjoiYXQrand0IiwiYWxnIjoiUlMyNTYifQ.eyJjbGllbnRfaWQiOiJkYi1tb2RlbHNlcnZpbmciLCJzY29wZSI6ImRhc2hib2FyZHMuZ2VuaWUgc3FsLnN0YXRlbWVudC1leGVjdXRpb24gc3FsLndhcmVob3VzZXMiLCJpc3MiOiJodHRwczovL2FkYi00Mjc1NDkwMDQ1MDgxODUzLjEzLmF6dXJlZGF0YWJyaWNrcy5uZXQvb2lkYyIsImF1ZCI6IjQyNzU0OTAwNDUwODE4NTMiLCJzdWIiOiI4ZTAwMTIxZi0yNWRmLTRkNTktYWRiMy1hNjVkZTY4NTQzNTEiLCJpYXQiOjE3Njc5ODM0NDYsImV4cCI6MTc2Nzk4NzA0NiwianRpIjoiZmM1NjQxMWYtNjE1MS00NDIwLTgwZWYtYTk0OGUzNjJlODVjIn0.aTHFkQ622XeVBz70vARworzl7cyBVf47fIzeRDN7yALO_TkLhT8YClreK_ht40OYCQPzvBoU3ucSjC2eXwtPohCxExvb88WUiFh6XcwqTtZQP9z8zqCJ32C82yaOIhL1SWHimpCppBnDXPl4x_lYXCy290Ryq5QL5S4q4qheKamrbn3zKF3s0bjQowlM_97GRRkdlT4xAY8bc16WRWzGi7h3hBjZ9Q1jYeWgDT5l8sOBT5u_B4i5XEhRhJa3OkfEC67sLodgDYL1G1DqP-P-n1reuZnGdtpwiS-GGJ0mn088wHpFUHQgMpAT8o0O7QgMRnFK7RR9hZoFxDvi3zduKw
[887s7] < 403 Forbidden
[887s7] < Invalid scope```

Additional context
The Exception suggest reporting this as an issue, hence this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-an-sdk-bugIssue is not in the SDK (server-side, wrong repo, user config, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions