mongo-express-docker icon indicating copy to clipboard operation
mongo-express-docker copied to clipboard

TypeError: Cannot read property 'listDatabases' of undefined

Open T00rk opened this issue 3 years ago • 0 comments

I updated my mongo-express kubernetes deployment to arm64v8/mongo-express:0.54 yesterday.

Since then, I got this error message :

Admin database is not accessible
TypeError: Cannot read property 'listDatabases' of undefined
    at Object.connectionData.updateDatabases (/node_modules/mongo-express/lib/db.js:41:11)
    at /node_modules/mongo-express/lib/router.js:94:11
    at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
    at next (/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
    at /node_modules/express/lib/router/index.js:281:22
    at param (/node_modules/express/lib/router/index.js:354:14)
    at param (/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/node_modules/express/lib/router/index.js:410:3)

I'm connecting to a mongodb statefulset of 3 replicas. It worked before update (I don't remember which version was working before this one).

My deployment.yaml looks like this

apiVersion: apps/v1
kind: Deployment
metadata: 
  name: mongo-ui-deploy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-ui
  template:
    metadata:
      labels:
        app: mongo-ui
    spec:
      containers:
        - name: mongo-ui
          image: arm64v8/mongo-express:0.54
          env:
            - name: ME_CONFIG_BASICAUTH_USERNAME
              value: '[auth_username]'
            - name: ME_CONFIG_BASICAUTH_PASSWORD
              value: '[auth_verystrongpassword]'
            - name: ME_CONFIG_MONGODB_ENABLE_ADMIN
              value: 'true'
            - name: ME_CONFIG_MONGODB_ADMINUSERNAME
              value: '[mongo_username]'
            - name: ME_CONFIG_MONGODB_ADMINPASSWORD
              value: '[mongo_verystrongpassword]'
            - name: ME_CONFIG_MONGODB_SERVER
              value: 'mongod-0.mongo-srv.default.svc.cluster.local,mongod-1.mongo-srv.default.svc.cluster.local,mongod-2.mongo-srv.default.svc.cluster.local'
            - name: ME_CONFIG_SITE_COOKIESECRET
              value: '[cookie-secret]'
            - name: ME_CONFIG_SITE_SESSIONSECRET
              value: '[session-secret]'   
            - name: ME_CONFIG_SITE_BASEURL
              value: '/'         
---
apiVersion: v1
kind: Service
metadata:
  name: mongo-ui-srv
spec:
  selector:
    app: mongo-ui
  ports:
    - name: mongo-ui
      protocol: TCP
      port: 8081
      targetPort: 8081
---

T00rk avatar Jun 18 '21 09:06 T00rk