`databricks apps logs` fails with `websocket: bad handshake (HTTP 302 Found)` on an OAuth U2M (`databricks-cli`) profile

Aperta
#6,605 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Inizia dal comando databricks apps logs e traccia la connessione WebSocket a /logz/stream, confrontando le relative credenziali e intestazioni con il token di databricks auth token. Verifica la correzione con il profilo OAuth U2M segnalato: l'upgrade WebSocket dovrebbe riuscire e trasmettere record di log JSON invece di ricevere HTTP 302.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

CLI

Versions: Databricks CLI v1.16.0 (Windows, winget) · Azure Databricks workspace · profile auth_type = databricks-cli (U2M, token in the OS keyring)

Repro

databricks apps logs <app-name> --tail-lines 20

Actual: --debug shows the CLI resolving the app and dialing wss://<app>.azure.databricksapps.com/logz/stream, then:

Error: websocket: bad handshake (HTTP 302 Found)

The 302 is the app domain redirecting to /oidc/oauth2/v2.0/authorize, so the credential on the request wasn't accepted.

Expected: the log stream.

Evidence that the app and permissions are fine (same user, same moment):

Request Result
GET https://<app>/logz with Authorization: Bearer $(databricks auth token) 200
GET https://<app>/logz without a token 302 to authorize
websocket upgrade wss://<app>/logz/stream with that bearer + Origin: https://<app> 101; after sending one empty text message, JSON log records stream normally

Forcing the CLI onto the same token as a PAT (DATABRICKS_AUTH_TYPE=pat, DATABRICKS_TOKEN=...) fails differently: Error: OAuth Token not supported for current auth type pat.

So the app domain accepts the workspace token from databricks auth token, but it rejects whatever credential apps logs attaches to its websocket dial.

Workaround: connect to /logz/stream directly with the bearer from databricks auth token, an Origin header, and an initial empty message.

Lingua principale
Go
Stelle
427
Fork
267
Merge medio
2g 1h
PR unite (30g)
233

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di databricks/cli

Tutte le issue di databricks/cli

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.