IoT Agent JSON version the issue has been seen with
3.9.0
Bound or port used (API interaction)
Other
NGSI version
Other
Are you running a container?
Yes, I am using a contaner (Docker, Kubernetes...)
Image type
distroless
Expected behaviour you didn't see
Perform user authentication in MongoDB with using environment variable "IOTA_MONGO_USER" and "IOTA_MONGO_PASSWORD"
Unexpected behaviour you saw
Unable to connect to MongoDB due to the following error:
"MongoParseError: credentials must be an object with 'username' and 'password' properties."
This occurs because MongoDB expects the credentials to be provided as options.auth.username and options.auth.password.
However, the current implementation in lib/model/dbConn.js uses options.auth.user, which does not conform to the expected format.
telefonicaid/iotagent-node-lib#1736
Steps to reproduce the problem
docker run --name mongodb -d -e MONGO_INITDB_ROOT_USERNAME=test -e MONGO_INITDB_ROOT_PASSWORD=test -p 27017:27017 mongo:8.0.0
Configs
environment:
- "IOTA_CB_HOST=orion"
- "IOTA_CB_PORT=1026"
- "IOTA_NORTH_PORT=4041"
- "IOTA_REGISTRY_TYPE=mongodb"
- "IOTA_MONGO_HOST=mongodb"
- "IOTA_MONGO_USER=test"
- "IOTA_MONGO_PASSWORD=test"
- "IOTA_MONGO_PORT=27017"
- "IOTA_MONGO_DB=iotagent-json"
- "IOTA_HTTP_PORT=7896"
- "IOTA_PROVIDER_URL=http://iot-agent:4041"
Log output
IoT Agent JSON version the issue has been seen with
3.9.0
Bound or port used (API interaction)
Other
NGSI version
Other
Are you running a container?
Yes, I am using a contaner (Docker, Kubernetes...)
Image type
distroless
Expected behaviour you didn't see
Perform user authentication in MongoDB with using environment variable "IOTA_MONGO_USER" and "IOTA_MONGO_PASSWORD"
Unexpected behaviour you saw
Unable to connect to MongoDB due to the following error:
"MongoParseError: credentials must be an object with 'username' and 'password' properties."
This occurs because MongoDB expects the credentials to be provided as
options.auth.usernameandoptions.auth.password.However, the current implementation in lib/model/dbConn.js uses
options.auth.user, which does not conform to the expected format.telefonicaid/iotagent-node-lib#1736
Steps to reproduce the problem
docker run --name mongodb -d -e MONGO_INITDB_ROOT_USERNAME=test -e MONGO_INITDB_ROOT_PASSWORD=test -p 27017:27017 mongo:8.0.0
Configs
Log output