Skip to content

Improve Superset auth error message on unexpected response shape#220

Merged
dmarulli merged 1 commit into
mainfrom
fix/xylem-datalake-auth-error-message
Apr 30, 2026
Merged

Improve Superset auth error message on unexpected response shape#220
dmarulli merged 1 commit into
mainfrom
fix/xylem-datalake-auth-error-message

Conversation

@dmarulli
Copy link
Copy Markdown
Collaborator

Summary

When /api/v1/me/ returns valid JSON without a result key, the code crashed with KeyError: 'result' and dropped the response body. Adds a guard mirroring the Content-Type check above so the actual response text surfaces in logs.

Context

cadc_crescent-ami-meter-read-dag-standard failed on 2026-04-29 with KeyError: 'result' at xylem_datalake.py:193. Root cause is unknown because the error swallowed the response. Likely candidates: expired Keycloak session, rate-limit, or Superset error envelope. This change makes future occurrences self-diagnosing.

Test plan

  • CI Black check passes
  • Verify on next Crescent/Hills run that auth still succeeds (no regression on the happy path)
  • If the failure recurs, the new RuntimeError surfaces the body so we can fix the actual cause

When /api/v1/me/ returns valid JSON without a 'result' key (e.g. an
error envelope from an expired session or a Superset error), the code
crashed with KeyError: 'result' and dropped the response body. Add a
guard mirroring the Content-Type check above so the actual response
text surfaces in logs.
@dmarulli dmarulli merged commit 03cbae2 into main Apr 30, 2026
2 checks passed
@dmarulli dmarulli deleted the fix/xylem-datalake-auth-error-message branch April 30, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant