Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Security

### Bug Fixes
* Add `X-Databricks-Org-Id` header to hand-written extension methods (`Workspace.upload()`, `Workspace.download()`, `Shares.list()`, `ServingEndpoints.http_request()`) for SPOG host compatibility.

* Add `X-Databricks-Org-Id` header to `WorkspaceExt.upload()` and `WorkspaceExt.download()` for SPOG host compatibility.
* `WorkspaceClient.get_workspace_id()` now returns `Config.workspace_id` directly when set, instead of calling `/api/2.0/preview/scim/v2/Me`. This removes an API round-trip on every call where the workspace ID is already known (profile, `?o=` query param, env var, or host metadata) and fixes a failure on SPOG hosts where the unauthenticated probe request was rejected with `Unable to load OAuth Config`.
Expand Down
6 changes: 5 additions & 1 deletion databricks/sdk/mixins/open_ai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ def http_request(
# This is a temporary fix to get the headers we need for the MCP session id
# TODO: Remove this once we have a better way to get back the response headers
headers_to_capture = ["mcp-session-id"]
request_headers = {"Accept": "text/plain", "Content-Type": "application/json"}
cfg = self._api._cfg
if cfg.workspace_id:
request_headers["X-Databricks-Org-Id"] = cfg.workspace_id
res = self._api.do(
"POST",
"/api/2.0/external-function",
Expand All @@ -181,7 +185,7 @@ def http_request(
"json": js.dumps(json) if json is not None else None,
"params": js.dumps(params) if params is not None else None,
},
headers={"Accept": "text/plain", "Content-Type": "application/json"},
headers=request_headers,
raw=True,
response_headers=headers_to_capture,
)
Expand Down
1 change: 1 addition & 0 deletions databricks/sdk/mixins/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def upload(
return self._api.do(
"POST",
"/api/2.0/workspace/import",
headers=headers,
files={"content": content},
data=data,
headers=headers,
Expand Down
Loading