Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2513

command aggregate requires authentication

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.1
    • Component/s: None
    • Labels:
    • Environment:
      IBM Cloud Databases for Mongo (2 nodes replicaset, not sharded)

      Hi, we have been experiencing "command aggregate requires authentication" and its variants "command find requires authentication", etc. with node-mongodb-native drive >3.4.1 (so minimum 3.4.1) and Mongo 4.2.

      It's intermittent and eventually goes away by itself for our serverless functions or sometimes requires us to restart the server for our typical node instances. Though I suspect for serverless functions, it fixes itself because we get a cold restart of the container and a new connection is established; difficult to tell.

      This is the full trace:

      "MongoError: command aggregate requires authentication
          at Connection.eval (eval at initializeActionHandler (/nodejsAction/runner.js:57:23), <anonymous>:27164:61)
          at Connection.emit (events.js:198:13)
          at processMessage (eval at initializeActionHandler (/nodejsAction/runner.js:57:23), <anonymous>:26005:10)
          at TLSSocket.eval (eval at initializeActionHandler (/nodejsAction/runner.js:57:23), <anonymous>:26174:15)
          at TLSSocket.emit (events.js:198:13)
          at addChunk (_stream_readable.js:288:12)
          at readableAddChunk (_stream_readable.js:269:11)
          at TLSSocket.Readable.push (_stream_readable.js:224:10)
          at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

      This is our options object for the serverless functions:

      const options = {
        ssl: true,
        sslValidate: true,
        sslCA: ca,
        useNewUrlParser: true,
        useUnifiedTopology: true,
        connectTimeoutMS: 600000,
        socketTimeoutMS: 600000,
        serverSelectionTimeoutMS: 600000

      and for our node server it simply is:

        ssl: true,
        sslValidate: true,
        sslCA: ca

            matt.broadstone@mongodb.com Matt Broadstone
            houman.k@myplanet.com Houman Kamali
            0 Vote for this issue
            4 Start watching this issue