-
Notifications
You must be signed in to change notification settings - Fork 2k
improve impersonation logging slightly #4758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Enhanced error handling and logging in the impersonation endpoint to improve debugging capabilities and error clarity.
- Changed HTTP status code from 404 to 422 in
/backend/ee/onyx/server/tenants/admin_api.py
for user not found scenarios - Added detailed error messages including both
email
andtenant_id
context in impersonation failures - Implemented try-catch block around tenant_id lookup with warning level logging for better error tracking
- Added explicit warning logs for both missing tenant mapping and user not found cases
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
if tenant_id is None: | ||
raise exceptions.UserNotExists() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider logging a warning here when tenant_id is None to help distinguish between exception cases and missing tenant cases
if tenant_id is None: | |
raise exceptions.UserNotExists() | |
if tenant_id is None: | |
logger.warning(f"No tenant found for email {email}") | |
raise exceptions.UserNotExists() |
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Description
current logging did not make the issue with an error here immediately obvious.
Fixes https://linear.app/danswer/issue/DAN-2004/improve-impersonation-logging.
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.