MongoDB - AuthenticationFailed #1171

Closed
opened 2026-03-22 17:13:13 -05:00 by GiteaMirror · 11 comments
Owner

Originally created by @wardwygaerts on GitHub (May 14, 2025).

I wanted to test komodo and tried with MongoDB, but failes

komodo-core        | Error: task 9 panicked with message "called `Result::unwrap()` on an `Err` value: failed to initialize database client\n\nCaused by:\n    failed to create index | index: enabled | error: Error { kind: Authentication { message: \"SCRAM failure: Authentication failed.\" }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: \"AuthenticationFailed\", message: \"Authentication failed.\", topology_version: None }), labels: {}, wire_version: None, source: None }) }"

No error in mongodb

When using postgres, everything is working fine, but I prefer not to have the additional ferret layer.

services:
  mongo:
    image: mongo
    labels:
      komodo.skip: null # Prevent Komodo from stopping with StopAllContainers
    command: --quiet --wiredTigerCacheSizeGB 0.25
    restart: unless-stopped
    logging:
      driver: ${COMPOSE_LOGGING_DRIVER:-local}
    # ports:
    #   - 27017:27017
    volumes:
      - mongo-data:/data/db
      - mongo-config:/data/configdb
    environment:
      - MONGO_INITDB_ROOT_USERNAME=${KOMODO_DB_USERNAME}
      - MONGO_INITDB_ROOT_PASSWORD=${KOMODO_DB_PASSWORD}
  core:
    image: ghcr.io/moghtech/komodo-core:latest
    container_name: komodo-core
    labels:
      komodo.skip: null
    restart: unless-stopped
    depends_on:
      #- ferretdb
      - mongo
    logging:
      driver: local
    ports:
      - 9120:9120
    env_file: .env
    environment:
      KOMODO_DATABASE_ADDRESS: mongo:27017
      KOMODO_DATABASE_USERNAME: ${KOMODO_DB_USERNAME}
      KOMODO_DATABASE_PASSWORD: ${KOMODO_DB_PASSWORD}
    volumes:
      ## Core cache for repos for latest commit hash / contents
      - repo-cache:/repo-cache
      ## Store sync files on server
      # - /path/to/syncs:/syncs
Originally created by @wardwygaerts on GitHub (May 14, 2025). I wanted to test komodo and tried with MongoDB, but failes ``` komodo-core | Error: task 9 panicked with message "called `Result::unwrap()` on an `Err` value: failed to initialize database client\n\nCaused by:\n failed to create index | index: enabled | error: Error { kind: Authentication { message: \"SCRAM failure: Authentication failed.\" }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: \"AuthenticationFailed\", message: \"Authentication failed.\", topology_version: None }), labels: {}, wire_version: None, source: None }) }" ``` No error in mongodb When using postgres, everything is working fine, but I prefer not to have the additional ferret layer. ``` services: mongo: image: mongo labels: komodo.skip: null # Prevent Komodo from stopping with StopAllContainers command: --quiet --wiredTigerCacheSizeGB 0.25 restart: unless-stopped logging: driver: ${COMPOSE_LOGGING_DRIVER:-local} # ports: # - 27017:27017 volumes: - mongo-data:/data/db - mongo-config:/data/configdb environment: - MONGO_INITDB_ROOT_USERNAME=${KOMODO_DB_USERNAME} - MONGO_INITDB_ROOT_PASSWORD=${KOMODO_DB_PASSWORD} core: image: ghcr.io/moghtech/komodo-core:latest container_name: komodo-core labels: komodo.skip: null restart: unless-stopped depends_on: #- ferretdb - mongo logging: driver: local ports: - 9120:9120 env_file: .env environment: KOMODO_DATABASE_ADDRESS: mongo:27017 KOMODO_DATABASE_USERNAME: ${KOMODO_DB_USERNAME} KOMODO_DATABASE_PASSWORD: ${KOMODO_DB_PASSWORD} volumes: ## Core cache for repos for latest commit hash / contents - repo-cache:/repo-cache ## Store sync files on server # - /path/to/syncs:/syncs ```
Author
Owner

@yunus-acar commented on GitHub (May 14, 2025):

I had a similar problem. Did you solve it? @wardwygaerts

@yunus-acar commented on GitHub (May 14, 2025): I had a similar problem. Did you solve it? @wardwygaerts
Author
Owner

@cehenriques commented on GitHub (May 18, 2025):

I had 2 issues with the Mongo setup that I solved:

  • First, the Mongo compose didn't have the "env_file" property to pass the environment variables from the compose.env file.
  • Second, I had issues running Mongo on my Proxmox VM - "MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!". Solved it by changing the CPU typo to "Host" on the VM settings.
@cehenriques commented on GitHub (May 18, 2025): I had 2 issues with the Mongo setup that I solved: - First, the Mongo compose didn't have the "env_file" property to pass the environment variables from the compose.env file. - Second, I had issues running Mongo on my Proxmox VM - "MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!". Solved it by changing the CPU typo to "Host" on the VM settings.
Author
Owner

@EliasMasche commented on GitHub (Jun 11, 2025):

I am having the same issue, too

called `Result::unwrap()` on an `Err` value: failed to initialize database client

Caused by:

    failed to create index | index: enabled | error: Error { kind: Authentication { message: "SCRAM failure: Authentication failed." }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: "AuthenticationFailed", message: "Authentication failed.", topology_version: None }), labels: {}, wire_version: None, source: None }) }

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Error: task 5 panicked with message "called `Result::unwrap()` on an `Err` value: failed to initialize database client\n\nCaused by:\n    failed to create index | index: enabled | error: Error { kind: Authentication { message: \"SCRAM failure: Authentication failed.\" }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: \"AuthenticationFailed\", message: \"Authentication failed.\", topology_version: None }), labels: {}, wire_version: None, source: None }) }"

Running on bare metal, my CPU supports AVX, and adding env_file: ./compose.env didn't help either

@EliasMasche commented on GitHub (Jun 11, 2025): I am having the same issue, too ```rust called `Result::unwrap()` on an `Err` value: failed to initialize database client Caused by: failed to create index | index: enabled | error: Error { kind: Authentication { message: "SCRAM failure: Authentication failed." }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: "AuthenticationFailed", message: "Authentication failed.", topology_version: None }), labels: {}, wire_version: None, source: None }) } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Error: task 5 panicked with message "called `Result::unwrap()` on an `Err` value: failed to initialize database client\n\nCaused by:\n failed to create index | index: enabled | error: Error { kind: Authentication { message: \"SCRAM failure: Authentication failed.\" }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: \"AuthenticationFailed\", message: \"Authentication failed.\", topology_version: None }), labels: {}, wire_version: None, source: None }) }" ``` Running on bare metal, my CPU supports AVX, and adding `env_file: ./compose.env` didn't help either
Author
Owner

@wardwygaerts commented on GitHub (Jun 17, 2025):

I had a similar problem. Did you solve it? @wardwygaerts

I removed everything, added a network and redeployed. Everything's working fine now

@wardwygaerts commented on GitHub (Jun 17, 2025): > I had a similar problem. Did you solve it? [@wardwygaerts](https://github.com/wardwygaerts) I removed everything, added a network and redeployed. Everything's working fine now
Author
Owner

@EliasMasche commented on GitHub (Jun 17, 2025):

Can you share your changes to verify if it will work on my side, too?

@EliasMasche commented on GitHub (Jun 17, 2025): Can you share your changes to verify if it will work on my side, too?
Author
Owner

@wardwygaerts commented on GitHub (Jun 18, 2025):

@EliasMasche :

docker-compose:

services:
  mongo:
    image: mongo
    container_name: komodo-mongo
    labels:
      komodo.skip: null
    command: --quiet --wiredTigerCacheSizeGB 0.25
    restart: unless-stopped
    networks:
      - local
    # ports:
    #   - 27017:27017
    env_file: .env
    volumes:
      - mongo-data:/data/db
      - mongo-config:/data/configdb
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${KOMODO_DB_USERNAME}
      MONGO_INITDB_ROOT_PASSWORD: ${KOMODO_DB_PASSWORD}
  core:
    image: ghcr.io/moghtech/komodo-core:latest
    container_name: komodo-core
    labels:
      komodo.skip: null
    restart: unless-stopped
    depends_on:
      - mongo
    logging:
      driver: local
    networks:
      - local
    ports:
      - 9121:9120
    env_file: .env
    environment:
      KOMODO_DATABASE_ADDRESS: mongo:27017
      KOMODO_DATABASE_USERNAME: ${KOMODO_DB_USERNAME}
      KOMODO_DATABASE_PASSWORD: ${KOMODO_DB_PASSWORD}
      #KOMODO_DATABASE_URI: mongodb://${KOMODO_DB_USERNAME}:${KOMODO_DB_PASSWORD}@ferretdb:27017/${KOMODO_DATABASE_DB_NAME:-komodo}?authMechanism=PLAIN
    volumes:
      - repo-cache:/repo-cache
volumes:
  # Mongo
  mongo-data: null
  mongo-config: null
  repo-cache: null
networks:
  local:
    external: true

env:

# DB credentials
KOMODO_DB_USERNAME=admin
KOMODO_DB_PASSWORD=*************************

# Configure a secure passkey to authenticate between Core / Periphery.
KOMODO_PASSKEY=*******************************

# General
KOMODO_HOST=http://192.x.x.x:9121
KOMODO_TITLE=Komodo
KOMODO_DISABLE_CONFIRM_DIALOG=false

KOMODO_MONITORING_INTERVAL="15-sec"
KOMODO_RESOURCE_POLL_INTERVAL="5-min"

# Secrets
KOMODO_WEBHOOK_SECRET=a_random_secret
KOMODO_JWT_SECRET=a_random_jwt_secret

# Auth
KOMODO_LOCAL_AUTH=true
KOMODO_DISABLE_USER_REGISTRATION=false
KOMODO_ENABLE_NEW_USERS=true
KOMODO_DISABLE_NON_ADMIN_CREATE=false
KOMODO_TRANSPARENT_MODE=false

KOMODO_JWT_TTL="1-day"
@wardwygaerts commented on GitHub (Jun 18, 2025): @EliasMasche : docker-compose: ``` services: mongo: image: mongo container_name: komodo-mongo labels: komodo.skip: null command: --quiet --wiredTigerCacheSizeGB 0.25 restart: unless-stopped networks: - local # ports: # - 27017:27017 env_file: .env volumes: - mongo-data:/data/db - mongo-config:/data/configdb environment: MONGO_INITDB_ROOT_USERNAME: ${KOMODO_DB_USERNAME} MONGO_INITDB_ROOT_PASSWORD: ${KOMODO_DB_PASSWORD} core: image: ghcr.io/moghtech/komodo-core:latest container_name: komodo-core labels: komodo.skip: null restart: unless-stopped depends_on: - mongo logging: driver: local networks: - local ports: - 9121:9120 env_file: .env environment: KOMODO_DATABASE_ADDRESS: mongo:27017 KOMODO_DATABASE_USERNAME: ${KOMODO_DB_USERNAME} KOMODO_DATABASE_PASSWORD: ${KOMODO_DB_PASSWORD} #KOMODO_DATABASE_URI: mongodb://${KOMODO_DB_USERNAME}:${KOMODO_DB_PASSWORD}@ferretdb:27017/${KOMODO_DATABASE_DB_NAME:-komodo}?authMechanism=PLAIN volumes: - repo-cache:/repo-cache volumes: # Mongo mongo-data: null mongo-config: null repo-cache: null networks: local: external: true ``` env: ``` # DB credentials KOMODO_DB_USERNAME=admin KOMODO_DB_PASSWORD=************************* # Configure a secure passkey to authenticate between Core / Periphery. KOMODO_PASSKEY=******************************* # General KOMODO_HOST=http://192.x.x.x:9121 KOMODO_TITLE=Komodo KOMODO_DISABLE_CONFIRM_DIALOG=false KOMODO_MONITORING_INTERVAL="15-sec" KOMODO_RESOURCE_POLL_INTERVAL="5-min" # Secrets KOMODO_WEBHOOK_SECRET=a_random_secret KOMODO_JWT_SECRET=a_random_jwt_secret # Auth KOMODO_LOCAL_AUTH=true KOMODO_DISABLE_USER_REGISTRATION=false KOMODO_ENABLE_NEW_USERS=true KOMODO_DISABLE_NON_ADMIN_CREATE=false KOMODO_TRANSPARENT_MODE=false KOMODO_JWT_TTL="1-day" ```
Author
Owner

@EliasMasche commented on GitHub (Jun 19, 2025):

Thanks with this was enough for the trick, now it works fine.

networks:
  local:
    external: true
@EliasMasche commented on GitHub (Jun 19, 2025): Thanks with this was enough for the trick, now it works fine. ```yaml networks: local: external: true ```
Author
Owner

@victornavorskie commented on GitHub (Jun 25, 2025):

I have the same issue and nothing works after the Komodo v1.18.0 version (https://github.com/moghtech/komodo/releases/tag/v1.18.0). Neither FerretDB nor MongoDB work, and I have even removed everything and set up from scratch. I have added labels for Traefik, which was working before and still is, but the Komodo core is full of MongoDB errors, such as 'Authentication Failed'.
Starting on http://[::]:9120
core-1 | 2025-06-25T11:54:55.429023Z ERROR core::schedule: failed to get actions for schedule update | failed to get all actions from db: Kind: SCRAM failure: password authentication failed for user 'admin', labels: {": Kind: Command failed: Error code 1 (InternalError): Password authentication failed for user 'admin', labels: {}.
Still not fixed.

@victornavorskie commented on GitHub (Jun 25, 2025): I have the same issue and nothing works after the Komodo v1.18.0 version (https://github.com/moghtech/komodo/releases/tag/v1.18.0). Neither FerretDB nor MongoDB work, and I have even removed everything and set up from scratch. I have added labels for Traefik, which was working before and still is, but the Komodo core is full of MongoDB errors, such as 'Authentication Failed'. Starting on http://[::]:9120 `core-1 | 2025-06-25T11:54:55.429023Z ERROR core::schedule: failed to get actions for schedule update | failed to get all actions from db: Kind: SCRAM failure: password authentication failed for user 'admin', labels: {": Kind: Command failed: Error code 1 (InternalError): Password authentication failed for user 'admin', labels: {}. ` Still not fixed.
Author
Owner

@terroreek commented on GitHub (Aug 14, 2025):

I can confirm I am getting the same error with the docker compose file, the komodo-core-1 container is just stuck in a continuous reboot cycle.

2025-08-14T15:39:49.612256748Z thread 'tokio-runtime-worker' panicked at bin/core/src/state.rs:47:6:
2025-08-14T15:39:49.612261238Z called `Result::unwrap()` on an `Err` value: failed to initialize database client
2025-08-14T15:39:49.612273677Z 
2025-08-14T15:39:49.612276027Z Caused by:
2025-08-14T15:39:49.612278357Z     failed to create index | index: enabled | error: Error { kind: Authentication { message: "SCRAM failure: Authentication failed." }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: "AuthenticationFailed", message: "Authentication failed.", topology_version: None }), labels: {}, wire_version: None, source: None }) }
2025-08-14T15:39:49.612281547Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2025-08-14T15:39:49.613656382Z Error: task 49 panicked with message "called `Result::unwrap()` on an `Err` value: failed to initialize database client\n\nCaused by:\n    failed to create index | index: enabled | error: Error { kind: Authentication { message: \"SCRAM failure: Authentication failed.\" }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: \"AuthenticationFailed\", message: \"Authentication failed.\", topology_version: None }), labels: {}, wire_version: None, source: None }) }"
@terroreek commented on GitHub (Aug 14, 2025): I can confirm I am getting the same error with the docker compose file, the komodo-core-1 container is just stuck in a continuous reboot cycle. ```2025-08-14T15:39:49.612239398Z 2025-08-14T15:39:49.612256748Z thread 'tokio-runtime-worker' panicked at bin/core/src/state.rs:47:6: 2025-08-14T15:39:49.612261238Z called `Result::unwrap()` on an `Err` value: failed to initialize database client 2025-08-14T15:39:49.612273677Z 2025-08-14T15:39:49.612276027Z Caused by: 2025-08-14T15:39:49.612278357Z failed to create index | index: enabled | error: Error { kind: Authentication { message: "SCRAM failure: Authentication failed." }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: "AuthenticationFailed", message: "Authentication failed.", topology_version: None }), labels: {}, wire_version: None, source: None }) } 2025-08-14T15:39:49.612281547Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 2025-08-14T15:39:49.613656382Z Error: task 49 panicked with message "called `Result::unwrap()` on an `Err` value: failed to initialize database client\n\nCaused by:\n failed to create index | index: enabled | error: Error { kind: Authentication { message: \"SCRAM failure: Authentication failed.\" }, labels: {}, wire_version: None, source: Some(Error { kind: Command(CommandError { code: 18, code_name: \"AuthenticationFailed\", message: \"Authentication failed.\", topology_version: None }), labels: {}, wire_version: None, source: None }) }" ```
Author
Owner

@martyp187 commented on GitHub (Aug 25, 2025):

I have the same issue and nothing works after the Komodo v1.18.0 version (https://github.com/moghtech/komodo/releases/tag/v1.18.0). Neither FerretDB nor MongoDB work, and I have even removed everything and set up from scratch. I have added labels for Traefik, which was working before and still is, but the Komodo core is full of MongoDB errors, such as 'Authentication Failed'. Starting on http://[::]:9120 core-1 | 2025-06-25T11:54:55.429023Z ERROR core::schedule: failed to get actions for schedule update | failed to get all actions from db: Kind: SCRAM failure: password authentication failed for user 'admin', labels: {": Kind: Command failed: Error code 1 (InternalError): Password authentication failed for user 'admin', labels: {}. Still not fixed.

I have the exact same after trying both DB backend options. Running on a Proxmox VM of Ubuntu using 'host' as CPU type.

@martyp187 commented on GitHub (Aug 25, 2025): > I have the same issue and nothing works after the Komodo v1.18.0 version (https://github.com/moghtech/komodo/releases/tag/v1.18.0). Neither FerretDB nor MongoDB work, and I have even removed everything and set up from scratch. I have added labels for Traefik, which was working before and still is, but the Komodo core is full of MongoDB errors, such as 'Authentication Failed'. Starting on http://[::]:9120 `core-1 | 2025-06-25T11:54:55.429023Z ERROR core::schedule: failed to get actions for schedule update | failed to get all actions from db: Kind: SCRAM failure: password authentication failed for user 'admin', labels: {": Kind: Command failed: Error code 1 (InternalError): Password authentication failed for user 'admin', labels: {}. ` Still not fixed. I have the exact same after trying both DB backend options. Running on a Proxmox VM of Ubuntu using 'host' as CPU type.
Author
Owner

@mbecker20 commented on GitHub (Aug 26, 2025):

If you deploy the default compose and compose.env on the host, without changing anything, does it work? If so, my guess is your password contains some invalid characters for URL. Try choosing a password only containing letters / numbers. Note that after you start up database for the first time, you can't change the init credentials. You have to drop the data.

I think there actually is an improvement Komodo can make, and this would be url-encoding the credentials for you. I believe the issue is password contains URL invalid character that needs to be url-encoded in order to work. But the simple fix right now is to choose username / password only containing simple characters.

@mbecker20 commented on GitHub (Aug 26, 2025): If you deploy the default compose and compose.env on the host, without changing anything, does it work? If so, my guess is your password contains some invalid characters for URL. Try choosing a password only containing letters / numbers. Note that after you start up database for the first time, you can't change the init credentials. You have to drop the data. I think there actually is an improvement Komodo can make, and this would be url-encoding the credentials for you. I believe the issue is password contains URL invalid character that needs to be url-encoded in order to work. But the simple fix right now is to choose username / password only containing simple characters.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#1171