-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.40.3
-
Component/s: Connectivity
-
None
-
Iteration Milky Way, Iteration Neptune, Iteration Ozone, Iteration Planetarium, Iteration Quasar, Iteration S (Dec 30 - Jan 13)
-
Developer Tools
When connecting to MongoDB server with no authentication provided to the server that requires it, Compass only shows an error and doesn't load anything:
If fetching some instance info failed for unexpected reasons, Compass will not proceed with trying to fetch anything else, like databases or collections list, making the application basically unusable.
We are currently already ignoring "not authorized" errors when fetching instance info, so one of the approaches to deal with this would be to extend the check to ignore "not authenticated" errors in these cases too.
See Slack thread for more details
Copy paste of the slack thread of longevity:
Alena Khineika
hey, in compass in mongosh when connecting with "[mongodb://127.0.0.1:27017/]" to a mongod that requires auth, it lets me in but shows the `Failed to retrieve server info
MongoServerError: Command hostInfo requires authentication` error. it doesn't seem to be expected, right? is it a known issue? (edited)
This file was not found.
Sergey Petushkov
Hmmm, not authorised errors should be ignored when fetching host info
This file was not found.
Sergey Petushkov
export function isNotAuthorized(err: any) { if (!err)
const msg = (err as Error).message || JSON.stringify(err); return new RegExp('not (authorized|allowed)').test(msg); }
Alena Khineika
in mongosh the error is MongoServerError: Command listDatabases requires authentication
Sergey Petushkov
Doesn't look like our no auth check is covering this (edited)
Sergey Petushkov
It's either a recent change in server error message that we didn't notice or most probably an old "issue" that was there for awhile already, just no one ever ran into this. Do we want to ignore not authenticated errors when fetching instance info in these cases in Compass?
Alena Khineika
but what we will see then when logged in? should we pass the connection form in this case or it should be connecting error?
Alena Khineika
isn't it an unauthorised kind of situation? (edited)
Sergey Petushkov
And we already ignore unauthorised, just our error matcher doesn't matches this error
Sergey Petushkov
Which is slightly different because it's not authenticated, personally I don't think it changes much for the expected Compass behavior
Sergey Petushkov
Anyway, this is a good catch, definitely not handled at the moment, I opened COMPASS-7675 to track it