Skip to content

MongoDB Authentication failed #704

@jorcapla

Description

@jorcapla

Hello,

I'm trying to connect perseo-fe with mongodb (with authentication enabled) and always raise AuthenticationFailed error.
Other components like orion,cygnus,... works Ok but perseo-fe fail. May you help me?

Error

(node:1) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(node:1) [MONGODB DRIVER] Warning: Warning: no saslprep library specified. Passwords will not be sanitized
time=2022-08-03T13:05:29.151Z | lvl=ERROR | corr=n/a | trans=n/a | op=checkDB | comp=perseo-fe | msg=connect failed to connect to server [mongo-db:27017] on first connect [MongoError: Authentication failed.
at Connection.messageHandler (/opt/perseo-fe/node_modules/mongodb/lib/core/connection/connection.js:359:19)
at Connection.emit (events.js:314:20)
at Connection.EventEmitter.emit (domain.js:506:15)
at processMessage (/opt/perseo-fe/node_modules/mongodb/lib/core/connection/connection.js:451:10)
at Socket. (/opt/perseo-fe/node_modules/mongodb/lib/core/connection/connection.js:620:15)
at Socket.emit (events.js:314:20)
at Socket.EventEmitter.emit (domain.js:506:15)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
at Socket.Readable.push (_stream_readable.js:213:10) {
ok: 0,
code: 18,
codeName: 'AuthenticationFailed'
}]

This is my docker-compose

version: "3.5"
services:
  orion:
    image: fiware/orion:2.2.0
    depends_on:
        - mongo-db
    networks:
        - default
    ports:
        - "1026:1026"
    command: -dbhost mongo-db -dbuser admin -dbpwd 2m4rt2022 
  mongo-db:
    image: mongo:latest
    ports:
        - "27017:27017"
    networks:
        - default
    command: --bind_ip_all 
    environment:
        - MONGO_INITDB_ROOT_USERNAME=admin
        - MONGO_INITDB_ROOT_PASSWORD=XXX
    
  cygnus-mongo:
    image: fiware/cygnus-ngsi:latest
    depends_on:
        - mongo-db
    networks:
        - default
    ports:
        - "5051:5051"
        - "5081:5081"
    environment:
        - CYGNUS_MONGO_HOSTS=mongo-db:27017 
        - CYGNUS_MONGO_DATA_MODEL=dm-by-service-path 
        - CYGNUS_MONGO_ATTR_PERSISTENCE=column 
        - CYGNUS_MONGO_DB_PREFIX=sti_
        - CYGNUS_MONGO_USER=admin
        - CYGNUS_MONGO_PASS=XXX
        - CYGNUS_MONGO_AUTH_SOURCE=admin
        - CYGNUS_STH_DB_PREFIX=sth_
        - CYGNUS_API_PORT=5081
        - CYGNUS_SERVICE_PORT=5051

      
  perseo-core:
    image: fiware/perseo-core:latest

    depends_on:
        - mongo-db
        - orion
    networks:
        - default
    ports:
        - "8080:8080"
    environment:
        - "PERSEO_FE_URL=http://perseo-fe:9090"
        - "MAX_AGE=3600000" 

  perseo-fe:
    image: fiware/perseo:latest
    networks:
        - default
    ports:
        - "9090:9090"
    depends_on:
         - perseo-core
         - mongo-db
    environment:
        - PERSEO_MONGO_ENDPOINT=mongo-db:27017 
        - PERSEO_MONGO_USER=admin
        - PERSEO_MONGO_PASS=XXX
        - PERSEO_MONGO_AUTH_SOURCE=admin
        - PERSEO_CORE_URL=http://perseo-core:8080
        - PERSEO_LOG_LEVEL=debug 
        - PERSEO_ORION_URL=http://orion:1026/  

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions