[COMPASS-4462] Connectivity exceptions are not caught in the connection form Created: 14/Oct/20  Updated: 10/Jan/24  Resolved: 03/Mar/22

Status: Closed
Project: Compass
Component/s: Connectivity
Affects Version/s: None
Fix Version/s: 1.31.0

Type: Bug Priority: Major - P3
Reporter: Maurizio Casimirri Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to COMPASS-4608 Ensure we can load instance details b... Closed
related to COMPASS-5075 Add react error boundaries to `connect` Closed
Epic Link: COMPASS-4948
Story Points: 5
Documentation Changes: Not Needed

 Description   

Some connection failures or authentication issues will break compass UI.

There are exceptions that are shown after the connection screen and causes the user to be stuck on a blank screen (disconnect won't work either).

To reproduce:

Add this line to /etc/hosts

127.0.0.1 mongodb-rs-1 mongodb-rs-2 mongodb-rs-3

Start this docker-compose configuration:

version: '2'
 
services:
  "mongodb-rs-1":
    image: "docker.io/bitnami/mongodb:4.4-debian-10"
    environment:
      MONGODB_ADVERTISED_HOSTNAME: "mongodb-rs-1"
      MONGODB_REPLICA_SET_MODE: "primary"
      MONGODB_ROOT_PASSWORD: "password123"
      MONGODB_REPLICA_SET_KEY: "replicasetkey123"
      MONGODB_PORT_NUMBER: "27001"
    ports:
      - "27001:27001"
 
  "mongodb-rs-2":
    image: "docker.io/bitnami/mongodb:4.4-debian-10"
    environment:
      MONGODB_ADVERTISED_HOSTNAME: "mongodb-rs-2"
      MONGODB_REPLICA_SET_MODE: "secondary"
      MONGODB_REPLICA_SET_KEY: "replicasetkey123"
      MONGODB_PORT_NUMBER: "27002"
      MONGODB_INITIAL_PRIMARY_HOST: "mongodb-rs-1"
      MONGODB_INITIAL_PRIMARY_PORT_NUMBER: "27002"
      MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD: "password123"
    ports:
      - "27002:27002"
 
  "mongodb-rs-3":
    image: "docker.io/bitnami/mongodb:4.4-debian-10"
    environment:
      MONGODB_ADVERTISED_HOSTNAME: "mongodb-rs-3"
      MONGODB_REPLICA_SET_MODE: "secondary"
      MONGODB_REPLICA_SET_KEY: "replicasetkey123"
      MONGODB_PORT_NUMBER: "27003"
      MONGODB_INITIAL_PRIMARY_HOST: "mongodb-rs-1"
      MONGODB_INITIAL_PRIMARY_PORT_NUMBER: "27003"
      MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD: "password123"
    ports:
      - "27003:27003"

Try to connect to:

mongodb://mongodb-rs-1:27001,mongodb-rs-1:27002,mongodb-rs-1:27003/db1?replicaSet=replicaset

 
Since we are not passing credentials it will be able to connect but cause an issue immediately.

Like this it connects:

mongodb://root:password123@mongodb-rs-1:27001,mongodb-rs-2:27002,mongodb-rs-3:27003/db1?authSource=admin&replicaSet=replicaset&readPreference=primary&appname=MongoDB%20Compass&ssl=false


Generated at Wed Feb 07 22:36:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.