bug(api): _doConnect swallows connection/auth errors and marks failed sessions as authenticated

Đang mở Phù hợp với người mới
#1,484 0 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

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

Từ ngày 3/12/2026.

  • #1485 của @ashwanisingh011 — đang mở

Đá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
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, react

Hướng nghiên cứu

Đọc packages/api/src/EmbeddedChatApi.ts và packages/react/src/views/EmbeddedChat.js để theo dõi cách lỗi kết nối được truyền đến trạng thái xác thực. Kiểm tra luồng kết nối để tìm lỗi từ kết nối, đăng nhập và các đăng ký stream, sau đó chạy các bài kiểm thử liên quan hoặc bổ sung kiểm thử cho các kết nối bị từ chối. Hoàn thành khi các kết nối thất bại bị từ chối và không đánh dấu người dùng là đã xác thực.

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

Mô tả

bug
Description:

In packages/api/src/EmbeddedChatApi.ts, _doConnect() catches errors from this.sdk.connection.connect(), this.sdk.account.loginWithToken(), and stream subscriptions, calls this.close(), and never rethrows the error.

Because _doConnect() resolves with undefined instead of rejecting, RCInstance.connect(isChannelPrivate).then(...) in packages/react/src/views/EmbeddedChat.js still executes and sets isUserAuthenticated(true) even though the DDP connection failed and was closed.

Steps to reproduce:
  1. Instantiate EmbeddedChatApi and trigger api.connect() while sdk.connection.connect() or sdk.account.loginWithToken() fails/rejects.
  2. Observe that api.connect() resolves normally instead of rejecting.
  3. In EmbeddedChat.js, .then() runs and marks isUserAuthenticated as true with no active DDP subscriptions.
Expected behavior:

_doConnect() should clean up via await this.close() and rethrow the error so connect() rejects and EmbeddedChat does not mark a failed connection as authenticated.

Actual behavior:

connect() resolves silently and EmbeddedChat logs "Connected to RocketChat ..." and sets isUserAuthenticated(true) on a closed socket.

Ngôn ngữ chính
JavaScript
Star
171
Fork
421
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
4

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 RocketChat/EmbeddedChat

Tất cả issue của RocketChat/EmbeddedChat

Issue tương tự

Thêm issue về JavaScript

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.