FIX: retry REST catalog on 401 UnauthorizedError with refresh token#1517
FIX: retry REST catalog on 401 UnauthorizedError with refresh token#1517MChamberlin wants to merge 1 commit intoapache:mainfrom
Conversation
|
Hey @MChamberlin Thanks for the PR. I have some concerns related to this approach
401 status is specifically for unauthorized requests https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 My suggestion would be to change the catalog implementation to send 419 instead. The REST spec specifically calls out 401 as UnauthorizedResponse and 419 as AuthenticationTimeoutResponse |
|
I agree with @kevinjqliu here. I've created this issue on polaris github to fix the root cause on the catalog instead: apache/polaris#791 |
Good point, I was thinking about this in the context of the Snowflake Polaris service, which I can't say for sure uses the OSS implementation. But the problem of course is upstream in the catalog responses either way. I will close the PR. |
|
@kevinjqliu @sungwy Given the decision on apache/polaris#791, I am re-opening this PR. |
|
Hi @MChamberlin thanks for following up! This PR was recently merged to introduce the fix following the decision to deprecate the 419 status code in the catalog community. Could you let you us know if the latest version of the code in main works for you as expected? #1741 |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
Some REST catalog implementations (including the Snowflake Polaris catalog) return a 401 when a token is expired, raising an
UnauthorizedErrorwithin pyiceberg. Refreshing the token, as is done for 419 responses, resolves the issue.This commit adds
UnauthorizedErrorto the retry exception types for REST catalog calls, such that the token will be refreshed and the call retried.