Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB Authentication failed #704

Open
jorcapla opened this issue Aug 3, 2022 · 2 comments
Open

MongoDB Authentication failed #704

jorcapla opened this issue Aug 3, 2022 · 2 comments
Labels

Comments

@jorcapla
Copy link

jorcapla commented Aug 3, 2022

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/  
@fgalan
Copy link
Member

fgalan commented Aug 5, 2022

I'm afraid the information in the logs is not providing too much information about the cause of the problem... just "AuthenticationFailed".

A couple of things you can try:

  • If authentication is disabled in MongoDB server, does it works?
  • You can check the MongoDB server logs in order to see if they provide more information about the cause of the authentication fail

Question: when did you dowloaded Perseo-FE from dockerhub? The :latest tag doesn't provide a precise version information...

Side-note: the Orion version you are using (2.2.0) is pretty old (February 2019). I'd recommend you to use the newest one (3.7.0).

@fgalan
Copy link
Member

fgalan commented Aug 5, 2022

Question: when did you dowloaded Perseo-FE from dockerhub? The :latest tag doesn't provide a precise version information...

Related with this, note that in the dockerhub FIWARE organization:

imagen

while in the telefonicaiot organization

imagen

Thus, the image in telefonicaiot is up to date, but the one in FIWARE organization isn't.

Maybe @jason-fox or somebody else from FIWARE Foundation could provide some information about why the Perseo-FE image is not being updated, please.

@AlvaroVega AlvaroVega added the P1 label Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants