Merge pull request #219 from christianlouis/copilot/fix-internal-server-error
Fix silent 500s in Google OAuth: log full tracebacks
This commit is contained in:
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
<!-- version list -->
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- OAuth Google sign-in: added `exc_info=True` to the catch-all exception handler in `auth_service.py` so the full traceback is always emitted to the log instead of only `str(e)`.
|
||||
- OAuth Google sign-in: added an endpoint-level try/except in the `/auth/google` handler to catch and log any unexpected errors (e.g. database failures) that occurred after the Google token exchange, which previously surfaced as silent 500s.
|
||||
|
||||
## v0.8.1 (2026-05-03)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -187,6 +187,7 @@ async def google_oauth(
|
||||
auth_request.redirect_uri,
|
||||
)
|
||||
|
||||
try:
|
||||
# Get user info from Google
|
||||
user_info = await oauth_service.get_google_user_info(
|
||||
code=auth_request.code, redirect_uri=auth_request.redirect_uri
|
||||
@@ -270,6 +271,19 @@ async def google_oauth(
|
||||
OAUTH_CALLBACKS_TOTAL.labels(provider="google", status="success").inc()
|
||||
return tokens
|
||||
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception:
|
||||
OAUTH_CALLBACKS_TOTAL.labels(provider="google", status="error").inc()
|
||||
logger.error(
|
||||
"OAuth [Google sign-in]: unhandled error during sign-in flow",
|
||||
exc_info=True,
|
||||
)
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="OAuth authentication failed",
|
||||
)
|
||||
|
||||
|
||||
@router.get("/google/authorize-url")
|
||||
async def get_google_authorize_url(redirect_uri: str):
|
||||
|
||||
@@ -142,7 +142,11 @@ class OAuthService:
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.error("OAuth [Google sign-in]: unexpected error: %s", e)
|
||||
logger.error(
|
||||
"OAuth [Google sign-in]: unexpected error: %s",
|
||||
e,
|
||||
exc_info=True,
|
||||
)
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="OAuth authentication failed",
|
||||
|
||||
Reference in New Issue
Block a user