RocketChat / helm-charts

Repository for RocketChat helm charts
37 stars 68 forks source link

MongoDB auth error, internal and external mongo #55

Open codecex opened 2 years ago

codecex commented 2 years ago

Im trying to deploy rocketchat using external mongodb, and im getting this error all the time, even if i use internal mongodb option:

`kc logs rocketchat-rocketchat-6b884967b4-h97pp -n rocketchat /app/bundle/programs/server/node_modules/fibers/future.js:313 throw(ex); ^

MongoError: Authentication failed. at MessageStream.messageHandler (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:272:20) at MessageStream.emit (events.js:400:28) at processIncomingData (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:144:12) at MessageStream._write (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:42:5) at writeOrBuffer (internal/streams/writable.js:358:12) at MessageStream.Writable.write (internal/streams/writable.js:303:10) at Socket.ondata (internal/streams/readable.js:731:22) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at Socket.Readable.push (internal/streams/readable.js:206:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) { operationTime: Timestamp { bsontype: 'Timestamp', low: 1, high_: 1648539416 }, ok: 0, code: 18, codeName: 'AuthenticationFailed', '$clusterTime': { clusterTime: Timestamp { bsontype: 'Timestamp', low: 1, high_: 1648539416 }, signature: { hash: Binary { _bsontype: 'Binary', sub_type: 0, position: 20, buffer: Buffer(20) [Uint8Array] [ 215, 121, 158, 104, 33, 118, 199, 10, 128, 84, 199, 167, 53, 69, 98, 19, 218, 86, 31, 49 ] }, keyId: Long { bsontype: 'Long', low: 2, high_: 1648484028 } } } } `

My external mongodb is working propertly in the same k8s cluster & namespace in replicaset mode. Im using this 2 options in the values.yaml to connect to an external mongodb: (internal is set to false)

externalMongodbUrl: mongodb://rocketchat:rocketpass@mongodb-headless.rocketchat.svc.cluster.local:27017/rocketchat externalMongodbOplogUrl: mongodb://root:rootpass@mongodb-headless.rocketchat.svc.cluster.local:27017/local?replicaSet=rs0&authSource=admin

What is wrong here?¿

Thanks in advance

prppedro commented 2 years ago

Does that issue still happens? It seems to be an environmental issue. What Kubernetes distribution are you using?

dberardo-com commented 2 years ago

still happening for me, the problem in my case is that i am trying to use an external secret to setup the internal DB and the pods fails to start because cant find the uri variables.

so i have included those but authentication fails. perhaps passwords should be b64 encoded in the uri ??

anyway some more doc on how the secret should like would be welcome

nicop311 commented 1 year ago

I have the same issue on k3s and rocketchat-5.3.2.

kubectl version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.25.3
Kustomize Version: v4.5.7
Server Version: v1.25.2+k3s1

I run the helm chart like this:

helm install rocketchat rocketchat/rocketchat --set mongodb.auth.password="mongoauth",mongodb.auth.rootPassword="rootmongopassword"
helm list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
rocketchat      default         1               2023-01-10 09:53:12.886609654 +0000 UTC deployed        rocketchat-5.3.2        5.3.2

Logs from the rocketchat pod:

/app/bundle/programs/server/node_modules/fibers/future.js:313                                            
                        throw(ex);                                                                       
                        ^                                                                                

MongoServerError: Authentication failed.                                                                 
    at MessageStream.messageHandler (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_m
    at MessageStream.emit (events.js:400:28)                                                             
    at processIncomingData (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mo
    at MessageStream._write (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/m
    at writeOrBuffer (internal/streams/writable.js:358:12)                                               
    at MessageStream.Writable.write (internal/streams/writable.js:303:10)                                
    at Socket.ondata (internal/streams/readable.js:731:22)                                               
    at Socket.emit (events.js:400:28)                                                                    
    at addChunk (internal/streams/readable.js:293:12)                                                    
    at readableAddChunk (internal/streams/readable.js:267:9)                                             
    at Socket.Readable.push (internal/streams/readable.js:206:10)                                        
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {                                       
  ok: 0,                                                                                                 
  code: 18,                                                                                              
  codeName: 'AuthenticationFailed',                                                                      
  '$clusterTime': {                                                                                      
    clusterTime: Timestamp { low: 1, high: 1673345675, unsigned: true },                                 
    signature: {                                                                                         
      hash: Binary {                                                                                     
        sub_type: 0,                                                                                     
        buffer: Buffer(20) [Uint8Array] [                                                                
          112, 104, 112,  16, 247,  60,                                                                  
          146, 115, 109, 254,  68, 109,                                                                  
           90, 141, 128,  23, 124, 111,                                                                  
          114, 181                                                                                       
        ],                                                                                               
        position: 20                                                                                     
      },                                                                                                 
      keyId: Long { low: 5, high: 1673343649, unsigned: false }                                          
    }                                                                                                    
  },                                                                                                     
  operationTime: Timestamp { low: 1, high: 1673345675, unsigned: true }                                  
}
ghost commented 1 year ago

You don't by chance happen to be deploying to a namespace called rocketchat?

I get the exact same error, but if I deploy to a namespace not called rocketchat but rc for example, my deployment succeeds. I'm using RKE2.