Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

The join endpoint returns an error shape the frontend cannot read

Đang mở Phù hợp với người mới
#192 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Anshuu2004 đang làm issue này rồi.

Từ ngày 24/10/2026.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
86/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
api, backend, frontend

Hướng nghiên cứu

Đọc apps/http-server/src/controllers/sessionController.ts và helper dùng chung apps/http-server/src/utils/error.ts, sau đó tìm trong service các lời gọi trực tiếp res.status(...).json({ message }) ở các nhánh lỗi. Thay phản hồi của endpoint tham gia bằng helper dùng chung và kiểm tra màn hình tham gia có đọc thông báo từ server hay không. Hoàn tất khi mọi lỗi của http-server đều dùng { success: false, error: string } và không còn phản hồi lỗi thô theo định dạng message.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Backend first issue bug good first issue help wanted

Every error in http-server goes through a shared helper:

// apps/http-server/src/utils/error.ts
export const errorResponse = (res: Response, statusCode: number, message: string) => {
    return res.status(statusCode).json({ success: false, error: message })
}

One line does not:

// apps/http-server/src/controllers/sessionController.ts:15
if (!code || !username) {
    return res.status(400).json({ message: "Code and username are required" });
}

Confirmed against the live API:

POST /api/v1/session/join  {}
→ {"message":"Code and username are required"}      # every other endpoint sends {success, error}
Why it matters

It is not only inconsistent — the message is silently dropped. The join screen reads .error:

// apps/frontend/src/screens/JoinQuiz.tsx
type JoinRequestError = { response?: { data?: { error?: string } } };
...
setError(joinError.response?.data?.error || "Failed to join quiz");

The server sends .message, so the fallback always wins and the user sees the generic "Failed to join quiz" instead of what actually went wrong.

The join screen validates client-side first, so today this mostly affects direct API calls and anything that bypasses the form — but it is a real swallowed message, and the inconsistency is a trap for the next person who adds an endpoint here.

What a fix looks like
return errorResponse(res, 400, "Code and username are required");

Then check the rest of the service for other raw res.json calls on error paths. The convention is well established — errorResponse is used 22 times in quizController, 9 in authController, 7 in inviteController, 5 elsewhere in sessionController — so anything else that does not use it is probably the same oversight.

Definition of done
  • Every error response from http-server has the shape { success: false, error: string }
  • The join screen shows the server's message rather than its fallback
  • No other raw res.status(...).json({ message }) remains on an error path

Good first issue: one line to fix, and a good way to learn a codebase convention by finding where it was not followed.

Ngôn ngữ chính
TypeScript
Star
21
Fork
7
Merge trung bình
4 giờ 31 phút
Pull request đã merge (30 ngày)
22

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TheCodeHeist-Coder/Rexial

Tất cả issue của TheCodeHeist-Coder/Rexial

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.