BUG: Missing await keyword in authentication dependency causes crash for logged-in users
@OmShukla-07 がすでに取り組んでいます。
2025年12月27日 から。
評価
この issue はまだ評価されていません。
説明
Is there an existing issue for this?
- I have searched the existing issues
What happened?
🐞 Bug Report: Two Critical Bugs Fixed in PR
Is there an existing issue for this?
- ✅ I have searched the existing issues
📌 Issue Overview
This PR fixes TWO separate critical bugs that were breaking the backend:
- Authentication Bug - Missing
awaitkeyword crashes logged-in users - Startup Crash Bug - Weaviate connection failure prevents backend from starting
🔍 Steps to Reproduce
Bug 1: Authentication Crash (dependencies.py)
- Go to
http://localhost:5173/login - Create an account and log in successfully
- Navigate to
/integrationspage - See the error:
AttributeError: 'coroutine' object has no attribute 'user'
Bug 2: Startup Crash (main.py)
- Ensure Weaviate is slow to start or has network issues
- Run
poetry run python main.pyin backend directory - Backend crashes with
httpcore.ConnectTimeouterror - See backend fails to start completely
🎯 Expected Behavior
Bug 1: Authentication
- Logged-in users should successfully access
/integrationspage - Integration status should load without crashing
- No
AttributeError: 'coroutine'in logs
Bug 2: Startup
- Backend should start even if Weaviate connection times out
- Show warning message instead of crashing
- Other features (Discord bot, API) should work normally
🚨 Actual Behavior
Bug 1: Authentication
AttributeError: 'coroutine' object has no attribute 'user'
INFO: 127.0.0.1:62135 - "GET /v1/integrations/status/discord HTTP/1.1" 401 Unauthorized
Result: Integration page completely broken for logged-in users
Bug 2: Startup
ERROR - Failed to connect to Weaviate: httpcore.ConnectTimeout
Traceback (most recent call last):
File "D:\FSOCIETY\GSOC\Devr.AI\backend\main.py", line 70, in test_weaviate_connection
raise
Result: Backend won't start, all services unavailable
📷 Screenshot
Before Fix:
Terminal: Backend crashes during startup
Browser: Cannot access integrations page (if backend somehow starts)
After Fix:
Terminal:
✅ Weaviate connection successful OR
⚠️ Failed to connect to Weaviate during startup: [error]
⚠️ Continuing without Weaviate - some features may not work
✅ Discord bot logged in as Devr.AI#5824
✅ Uvicorn running on http://0.0.0.0:8000
Browser:
✅ Integration page loads successfully for logged-in users
✅ No AttributeError crashes
💡 Suggested Improvements (Already Implemented)
Fix 1: Add Missing await Keyword
File: backend/app/core/dependencies.py
Line: 50
# BEFORE (Broken):
user_response = supabase.auth.get_user(token)
# AFTER (Fixed):
user_response = await supabase.auth.get_user(token)
Why needed:
- Supabase uses
AsyncClient- all auth methods are async - Without
await, Python tries to access.userattribute before data loads - Bug was introduced by CodeRabbit AI in commit
cedaad3(Oct 16, 2025)
Fix 2: Make Weaviate Connection Non-Blocking
File: backend/main.py
Lines: 68-72
# BEFORE (Broken):
except Exception as e:
logger.error(f"Failed to connect to Weaviate: {e}")
raise # ❌ This crashes entire backend
# AFTER (Fixed):
except Exception as e:
logger.warning(f"Failed to connect to Weaviate during startup: {e}")
logger.warning("Continuing without Weaviate - some features may not work")
# Don't raise - allow backend to start even if Weaviate is unavailable
Why needed:
- Weaviate client tries to connect to PyPI for version checks during init
- Network timeouts or slow connections would crash entire backend
- Backend should gracefully degrade instead of completely failing
- Discord bot, API endpoints, and other services don't depend on Weaviate to start
🔗 Root Cause Analysis
Bug 1: Authentication
Introduced by: CodeRabbit AI automated refactoring
Commit: cedaad3194a4c2fcd7c5d76aa6f096e17db11f78
Date: October 16, 2025
Original correct code: Commit ee34c94 had await keyword
Git history proof:
$ git show cedaad3 backend/app/core/dependencies.py
- user_response = await supabase.auth.get_user(token) # Original (correct)
+ user_response = supabase.auth.get_user(token) # Bug introduced
Bug 2: Weaviate Startup
Design issue: Original implementation treated Weaviate connection failure as fatal
Problem: Weaviate tries to connect to https://pypi.org/pypi/weaviate-client/json during startup
Result: Network issues or slow connections crash entire backend
Why not caught earlier:
- Weaviate usually starts quickly in Docker
- Most testing done in environments with good network connectivity
- Bug only appears when Weaviate is slow or network has issues
📊 Impact Assessment
Bug 1: Authentication
Severity: 🔴 Critical
Affected users: All logged-in dashboard users
Broken features:
- Integration status page
- Integration management
- Settings page
- Any authenticated API endpoint
Working features (unaffected):
- Discord bot commands
- Public landing page
- User registration
- Login (authentication itself)
Bug 2: Weaviate Startup
Severity: 🔴 Critical
Affected users: Everyone (backend won't start)
Broken features:
- Entire backend unavailable
- Discord bot can't connect
- All API endpoints down
- Frontend can't fetch data
Record
- ✅ I agree to follow this project's Code of Conduct
- ✅ I want to work on this issue (already fixed in PR)
Related Files
backend/app/core/dependencies.py- Authentication fixbackend/main.py- Startup robustness fixbackend/app/database/supabase/client.py- AsyncClient usagedocs/issues/ISSUE_002_Missing_Await_In_Auth_Dependency.md- Detailed documentation
References
- Supabase Python AsyncClient: https://supabase.com/docs/reference/python/introduction
- Python Async/Await: https://docs.python.org/3/library/asyncio-task.html
- Weaviate Python Client: https://weaviate.io/developers/weaviate/client-libraries/python
- FastAPI Dependencies: https://fastapi.tiangolo.com/tutorial/dependencies/
Report created by: Om Shukla (@OmShukla-07)
Date: December 1, 2025
Record
- I agree to follow this project's Code of Conduct
- I want to work on this issue
- 主要言語
- Python
- スター
- 103
- フォーク
- 143
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AOSSIE-Org/Devr.AI のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
AOSSIE-Org/Devr.AI#315 · コメント 1 件 ·
-
Bump Weaviate image to 1.39.13 (Go 1.26.10 / CVE-2026-111943)対応中かも @dudanogueira が 38 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AOSSIE-Org/Devr.AI#309 · コメント 1 件 ·
-
DOCS UPDATE: Incorrect Flask command path in backend installation guide対応中かも @Ashwin-Pillai-22 が 321 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
AOSSIE-Org/Devr.AI#229 · コメント 3 件 ·
-
BUG:Devr.AI Agent loses user_profile for returning users and fails to persist conversation summaries & cumulative interaction counts対応中かも @shubhumre777 が 34 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
AOSSIE-Org/Devr.AI#311 · コメント 2 件 ·
-
BUG: Local pytest suite fails to collect due to deprecated imports and mock schemas再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
AOSSIE-Org/Devr.AI#307 · コメント 1 件 ·
AOSSIE-Org/Devr.AI の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
QuantConnect/lean-cli#792 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
open-webui/open-webui#35360 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)オープン
難易度 1/5 1時間未満 初心者へのやさしさ 68/100