Skip to content

fix(login): gracefully handle network drop crash during authentication#1211

Open
deepak0x wants to merge 1 commit intoRocketChat:developfrom
deepak0x:fix/1210-login-network-error-crash
Open

fix(login): gracefully handle network drop crash during authentication#1211
deepak0x wants to merge 1 commit intoRocketChat:developfrom
deepak0x:fix/1210-login-network-error-crash

Conversation

@deepak0x
Copy link
Contributor

Handle undefined response in login hook

When a user attempts to log in but encounters a network error (e.g. net::ERR_NETWORK_CHANGED), the fetch call in EmbeddedChatApi.login throws an error. The catch block logs the error but implicitly returns undefined. Subsequently, useRCAuth.js attempts to read res.error, leading to an uncaught TypeError: Cannot read properties of undefined (reading 'error') which completely breaks the login flow.

This adds a falsy check for the response object and dispatches a user-friendly toast message informing them of the network connection issue instead of crashing.

Fixes #1210

@deepak0x deepak0x force-pushed the fix/1210-login-network-error-crash branch from 99948a5 to 8704cc0 Compare March 16, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Uncaught TypeError in useRCAuth on Network Error during login

1 participant