bug(api): _doConnect swallows connection/auth errors and marks failed sessions as authenticated
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, react
- Domain
- authentication, backend-api-design
Research direction
Read packages/api/src/EmbeddedChatApi.ts and packages/react/src/views/EmbeddedChat.js to trace how connection errors reach the authentication state. Check the connect flow for failures from the connection, login, and stream subscriptions, then run the relevant tests or add coverage for rejected connections. Done means failed connections reject and do not mark the user authenticated.
Written by the indexing model from the issue text.
Description
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:
- Instantiate
EmbeddedChatApiand triggerapi.connect()whilesdk.connection.connect()orsdk.account.loginWithToken()fails/rejects. - Observe that
api.connect()resolves normally instead of rejecting. - In
EmbeddedChat.js,.then()runs and marksisUserAuthenticatedastruewith 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.
- Dominant language
- JavaScript
- Stars
- 171
- Forks
- 421
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RocketChat/EmbeddedChat
-
Bug: username fallback in updateUserUsername never runs since the ddp-client migrationPossibly taken @MuhammadFaizan-prog claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RocketChat/EmbeddedChat#1489 ·
Maintainers usually reply within 1 day
-
[Bug]: Low contrast on color swatch borders in Theme Lab (Layout Editor)Possibly taken @yashsarvaiya45 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
RocketChat/EmbeddedChat#1486 ·
Maintainers usually reply within 1 day
-
Bug: White screen crash (`Cannot read properties of undefined (reading 'members')`) when rendering UserMention outside MarkupInteractionContextPossibly taken @swarnendusahu10-dotcom claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RocketChat/EmbeddedChat#1482 ·
Maintainers usually reply within 1 day
-
Bug: UIKit PreviewBlock cover image tiles repeatedly and stretches across viewport when zoomed outPossibly taken @swarnendusahu10-dotcom claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
RocketChat/EmbeddedChat#1480 · 1 comment ·
Maintainers usually reply within 1 day
-
ug(react): guard against null childElement in MessageAggregator setJumpToMessagePossibly taken @Suraj704-glitch claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
RocketChat/EmbeddedChat#1478 ·
Maintainers usually reply within 1 day
All issues in RocketChat/EmbeddedChat
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
quasarframework/quasar#18614 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
microsoft/monaco-editor#5626 ·
Maintainers usually reply within 1 day
-
bug/1-unconfirmed kind/bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
521xueweihan/HelloGitHub#4714 ·