← 输入框|github.com|刷新
Skip to content

[python] Show why the server refused a credential. - #7858

Merged
blp merged 1 commit into
mainfrom
python-401-reason
Nov 6, 2026
Merged

blp merged 1 commit into
mainfrom
python-401-reason

Conversation

@blp

@blp blp commented Nov 5, 2026

Copy link
Copy Markdown
Member

Linked Issue

Related to #7048. This does not fix it.

On a 401, the pipeline manager gives the reason in the error_description of its WWW-Authenticate header, and the body is empty. The client error read only the body, so it said "credential rejected (invalid or expired token / API key)" for every refusal.

In the two most recent reports in #7048 (runs 39514151001 and 41968241434), the token refresher log shows a refresh every 90 seconds with no misses. So the server refused tokens that had not expired. The client logs cannot show why.

The 401 error message now has a Reason: line with that description. On the next failure, the CI log will show which check refused the token.

Describe Manual Test Plan

New unit tests in python/tests/unit/test_401_reason.py. The escaped-quote test fails when errors.py is reverted. All of tests/unit passes.

Checklist

  • Unit tests added/updated
  • Integration tests added/updated
  • Documentation updated
  • Changelog updated

Breaking Changes?

Mark if you think the answer is yes for any of these components:

Describe Incompatible Changes

None. Only the text of 401 error messages changes.

@mythical-fred-oss

Copy link
Copy Markdown
Contributor

LGTM.

Ran: uv run --locked pytest tests/unit (424 passed) and pre-commit run on the changed files (ruff and ruff-format passed). I also tried a few extra WWW-Authenticate headers by hand: a challenge with several params (realm, error, error_description), an escaped backslash, an unquoted value (returns None) and an unterminated quote (returns None). All behave as expected. No gates fail.

@blp blp mentioned this pull request Nov 5, 2026
12 tasks
@blp blp added python Pull requests that update python code python-sdk Issues related to the feldera python sdk authentication Everything related to OIDC, AWS Cognito, auth0, tenants, issuers etc. CI/CD QA Testing and quality assurance labels Nov 5, 2026
@blp blp self-assigned this Nov 5, 2026
@blp
blp added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 5, 2026
On a 401, the pipeline manager gives the reason in the
`error_description` of its `WWW-Authenticate` header, and the body is
empty. The client error read only the body, so it said "credential
rejected (invalid or expired token / API key)" for every refusal. In
could not show why.

The 401 error message now has a `Reason:` line with that description.

Signed-off-by: Ben Pfaff <blp@feldera.com>
@blp
blp force-pushed the python-401-reason branch from 63dda0e to 4571416 Compare November 5, 2026 22:23
@blp
blp added this pull request to the merge queue Nov 5, 2026
@gz

gz commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

It may help to also query /healthz in this case to find out more, I believe if the database is unreachable it could also result in a 401

Merged via the queue into main with commit 7d1607e Nov 6, 2026
1 check passed
@blp
blp deleted the python-401-reason branch November 6, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

authentication Everything related to OIDC, AWS Cognito, auth0, tenants, issuers etc. CI/CD python Pull requests that update python code python-sdk Issues related to the feldera python sdk QA Testing and quality assurance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants