Skip to content

Commit facc595

Browse files
committed
error logs fixed
1 parent 813a71a commit facc595

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

apps/backend/app/auth/service.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ async def get_or_create_user(
9090
"avatar_url": new_user.avatar_url,
9191
}
9292
except Exception as e:
93+
# IMPORTANT: Re-raise exception so wrapper can handle it and expose error
94+
print(f"ERROR: {e}", file=sys.stderr, flush=True)
95+
import traceback
96+
traceback.print_exc(file=sys.stderr)
97+
raise e
9398
import traceback
9499
import sys
95100
print(f"[AUTH ERROR] get_or_create_user failed: {e}", file=sys.stderr, flush=True)

apps/backend/app/exceptions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,7 @@ async def http_exception_handler(request: Request, exc: HTTPException):
4242

4343
async def general_exception_handler(request: Request, exc: Exception):
4444
"""Global general exception handler"""
45-
return JSONResponse(status_code=500, content={"detail": "Internal server error"})
45+
import traceback
46+
print(f"Global exception: {exc}")
47+
traceback.print_exc()
48+
return JSONResponse(status_code=500, content={"detail": f"Internal server error: {str(exc)}"})

apps/backend/app/routes/auth.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ async def google_auth(request: GoogleAuthRequest):
4444
)
4545

4646
if not user:
47-
raise HTTPException(status_code=500, detail="Failed to authenticate user — check POSTGRES_URL in .env")
47+
raise HTTPException(
48+
status_code=500,
49+
detail="Authentication failed. User creation returned None. Check server logs."
50+
)
4851

4952
# Create JWT token
5053
access_token = auth_service.create_access_token(

0 commit comments

Comments
 (0)