[COMPASS-2990] Compass bug when connect to Azure Cosmos/Atlas Free Tier Created: 02/Jan/18  Updated: 29/Oct/23  Resolved: 11/Dec/18

Status: Closed
Project: Compass
Component/s: Compass
Affects Version/s: None
Fix Version/s: 1.17.0, 1.18.0

Type: Bug Priority: Major - P3
Reporter: Lalanarwon [X] Assignee: Durran Jordan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:
  • Window 10
  • Compass version 1.11.1

Attachments: PNG File Compass show error.png     PNG File null user.png    
Sprint: Iteration Takaioko

 Description   

Step:

1. Connect to Azure Cosmos DB with SSL option "System CA / Atlas Deployment"
2. Compass show loading DB icon on the left top of the program and console show error.

Uncaught TypeError: Cannot read property 'inheritedPrivileges' of undefined
at Object.getResourcesWithActions (C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:71)
at listDatabases (C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:182)
at runTask (C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:1618)
at C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:1558
at processQueue (C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:1568)
at taskComplete (C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:1587)
at C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:1611
at C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:958
at C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:316
at handleCallback (C:\Users\Kizeki-Dell\AppData\Local\MongoDBCompassCommunity\app-1.11.1\resources\app.asar\node_modul…:120)

Cause:

Function "getUserInfo", in file "node_modules\mongodb-data-service\lib\instance-detail-helper.js" line 316: done(null, _res.users[0]);, should support when _res.users is empty array.

I found it got empty array when connect to Azure Cosmos and it was error when call function "getResourcesWithActions" in "node_modules\mongodb-security\index.js" line 71: var privileges = userOrRole.inheritedPrivileges; while userOrRole was undefined but it try to get userOrRole.inheritedPrivileges.

Note:
He has same problem with me.
https://social.msdn.microsoft.com/Forums/azure/en-US/a38d9830-1f3f-4378-91d3-083a8b7e8631/connect-to-cosmos-db-by-compass?forum=AzureDocumentDB



 Comments   
Comment by Githook User [ 11/Dec/18 ]

Author:

{'name': 'Durran Jordan', 'email': 'durran@gmail.com', 'username': 'durran'}

Message: COMPASS-2990: Connect with Azure Cosmos
Branch: COMPASS-2990
https://github.com/10gen/compass/commit/d149e8ce118c53854fa59a7ff129905567aa4078

Comment by Vitaliy M [ 11/Jul/18 ]

Anyone, willing really hard to connect to Cosmos, may hack it fast to get some of the app features:

npx asar extract app.asar app
mv app.asar app.asar.bak

In the app/node_modules/mongodb-security/index.js add this in the beginning of the getResourcesWithActions function:

 if (!userOrRole) { return []; }

 

*works for version 1.14.6 

Comment by Durran Jordan [ 04/Jan/18 ]

Thank you very much for the detailed report but unfortunately Compass only supports connecting to MongoDB deployments. Azure Cosmos is not supported.

Note that while Cosmos has a MongoDB API and has support for the MongoDB wire protocol, it is a subset of the actual commands that MongoDB has and the particular one in question here causing the error is userInfo which Cosmos does not have (https://docs.microsoft.com/en-us/azure/cosmos-db/mongodb-feature-support). If you'd like to have your data on Azure, might I suggest using MongoDB Atlas instead and hosting your instances on Azure?

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