Uploaded image for project: 'VS Code Extension'
  1. VS Code Extension
  2. VSCODE-371

Trying to run playground connected to replica set with auth enabled fails

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: Connectivity
    • Labels:
      None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • Not Needed
    • Up for triaging

      Problem Statement/Rationale

      Specifically, this issue arose when we switched our mongo servers to require authentication. In production we are running replica sets with auth enabled and I can connect to the database and can click on individual documents in the lefthand navigation tree and view documents. When I try to run a playground the editor pane that shows the results never opens. 

      Steps to Reproduce

      • Create a replica set with authentication enabled and create a db called Test.
      • Add a user and give them read-only access to just the Test database.
      • Connect via the vscode mongodb client (I'm using a connection string) and attempt to run a playground against a collection in the Test db.

      Expected Results

      And editor window should open up with the results from the query.

      Actual Results

      The message window in the lower right corner pops up with the message "Running MongoDb playground" and the popup disappears and nothing happens...the results window/pane does not open.

      Additional Notes

      In production I only have read access to the application database (not admin, etc). I believe this is the same issue outlined here. The debug output from the vscode mongodb server console:

       
      MONGOSH get list databases...
      MONGOSH found 4 databases
      MONGOSH get list databases...
      [Error - 11:50:41 AM] MONGOSH get list databases error: MongoServerError: not authorized on admin to execute command { listDatabases: 1, lsid:

      { id: UUID(**REDACTED**) }

      , $clusterTime: { clusterTime: Timestamp(1676577037, 6), signature:

      { hash: BinData(0, **REDACTED**), keyId: **REDACTED** }

      }, $db: "admin" }
      at Connection.onMessage (/Users/bernard.schreiber/.vscode/extensions/mongodb.mongodb-vscode-0.10.0/dist/languageServerWorker.js:96030:30)
      at MessageStream.<anonymous> (/Users/bernard.schreiber/.vscode/extensions/mongodb.mongodb-vscode-0.10.0/dist/languageServerWorker.js:95863:60)
      at MessageStream.emit (node:events:526:28)
      at processIncomingData (/Users/bernard.schreiber/.vscode/extensions/mongodb.mongodb-vscode-0.10.0/dist/languageServerWorker.js:97259:16)
      at MessageStream._write (/Users/bernard.schreiber/.vscode/extensions/mongodb.mongodb-vscode-0.10.0/dist/languageServerWorker.js:97167:9)
      at writeOrBuffer (node:internal/streams/writable:389:12)
      at _write (node:internal/streams/writable:330:10)
      at Writable.write (node:internal/streams/writable:334:10)
      at Socket.ondata (node:internal/streams/readable:754:22)
      at Socket.emit (node:events:526:28)
      /Users/bernard.schreiber/.vscode/extensions/mongodb.mongodb-vscode-0.10.0/dist/languageServer.js:43639
      this._connection.console.log(`MONGOSH found ${result.length} databases`);
       
      TypeError: Cannot read properties of undefined (reading 'length')
      at /Users/bernard.schreiber/.vscode/extensions/mongodb.mongodb-vscode-0.10.0/dist/languageServer.js:43639:74
      at process.processTicksAndRejections (node:internal/process/task_queues:96:5)

            Assignee:
            Unassigned Unassigned
            Reporter:
            bernard.schreiber@thereformation.us Bernard Schreiber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: