AOSSIE-Org / AOSSIE-Org/DebateAI
[BUG]: WebSocket URLs hardcoded to ws://localhost:1313 — breaks any non-local deployment
- Ngôn ngữ chính
- TypeScript
- Star
- 84
- Fork
- 198
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 30
Mô tả
### Bug Description
Several frontend WebSocket call sites hardcode the backend address instead of deriving it from `VITE_BASE_URL`:
- `frontend/src/components/Matchmaking.tsx` line 62
- (same pattern in other raw `new WebSocket(...)` call sites: `ChatRoom.tsx`, `TeamDebateRoom.tsx`, `Game.tsx`, `gamificationService.ts`)
`frontend/src/components/DebatePopup.tsx` line 31 also hardcodes `http://localhost:1313` for room creation.
## Impact
Matchmaking, chat, and room creation silently fail on any deployed environment (or even when the backend runs on a different port). The UI shows a permanent "connecting"/"Searching…" state with no error.
## Suggested Fix
Build WS URLs from `import.meta.env.VITE_BASE_URL` (swapping `http` → `ws`), in one shared helper.
### Steps to Reproduce
_No response_
### Logs and Screenshots
_No response_
### Environment Details
_No response_
### Impact
Critical - Application is unusable
### Code of Conduct
- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start with the raw new WebSocket(...) call sites in frontend/src/components/Matchmaking.tsx, ChatRoom.tsx, TeamDebateRoom.tsx, Game.tsx, and gamificationService.ts, then inspect frontend/src/components/DebatePopup.tsx and the VITE_BASE_URL usage. Confirm the shared URL approach works for deployed and non-default backend addresses, and verify that matchmaking, chat, and room creation no longer use hardcoded localhost URLs.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript, vite
- Lĩnh vực
- api, frontend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 72/100