question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UserNotFound: Could not find user root@admin

See original GitHub issue

Followed the instructions and brought up the docker instances (Win10). It looks like the database isn’t automatically creating the admin user (?) and I’m not sure how to manually create that user in the db, or whether I should. I have tried resetting, cleaning the directories. I have copy-pasted the .env file for local testing, but am getting that error. Going to http://app.saas.localhost:3000 also has no effect. Should I have configured something manually? I THINK I did everything right, but I can’t get it to run. Log below.

yarn run v1.13.0 $ docker-compose up Creating network “app_default” with driver “bridge” Creating saas-mongo … done Creating saas-mongoexp … done Creating saas-api … done Creating saas-app … done Attaching to saas-mongo, saas-mongoexp, saas-api, saas-app saas-mongoexp | Waiting for saas-mongo:27017… saas-mongo | 2019-08-06T19:27:03.508+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’ saas-mongo | 2019-08-06T19:27:03.513+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=6312e08b6a63 saas-mongo | 2019-08-06T19:27:03.513+0000 I CONTROL [initandlisten] db version v4.0.11 saas-mongoexp | /docker-entrypoint.sh: connect: Connection refused saas-mongo | 2019-08-06T19:27:03.513+0000 I CONTROL [initandlisten] git version: 417d1a712e9f040d54beca8e4943edce218e9a8c saas-mongo | 2019-08-06T19:27:03.513+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 saas-mongo | 2019-08-06T19:27:03.513+0000 I CONTROL [initandlisten] allocator: tcmalloc saas-mongo | 2019-08-06T19:27:03.513+0000 I CONTROL [initandlisten] modules: none saas-mongo | 2019-08-06T19:27:03.513+0000 I CONTROL [initandlisten] build environment: saas-mongo | 2019-08-06T19:27:03.514+0000 I CONTROL [initandlisten] distmod: ubuntu1604 saas-mongo | 2019-08-06T19:27:03.514+0000 I CONTROL [initandlisten] distarch: x86_64 saas-mongo | 2019-08-06T19:27:03.514+0000 I CONTROL [initandlisten] target_arch: x86_64 saas-mongo | 2019-08-06T19:27:03.514+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true }, security: { authorization: “enabled” } } saas-mongo | 2019-08-06T19:27:03.515+0000 I STORAGE [initandlisten] Detected data files in /data/db created by the ‘wiredTiger’ storage engine, so setting the active storage engine to ‘wiredTiger’. saas-mongo | 2019-08-06T19:27:03.515+0000 I STORAGE [initandlisten] saas-mongo | 2019-08-06T19:27:03.515+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine saas-mongo | 2019-08-06T19:27:03.515+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem saas-mongoexp | /docker-entrypoint.sh: line 14: /dev/tcp/saas-mongo/27017: Connection refused saas-mongoexp | Tue Aug 6 19:27:05 UTC 2019 retrying to connect to saas-mongo:27017 (2/5) saas-mongoexp | /docker-entrypoint.sh: connect: Connection refused saas-app | yarn run v1.16.0 saas-mongo | 2019-08-06T19:27:03.515+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress), saas-api | yarn run v1.16.0 saas-mongo | 2019-08-06T19:27:05.480+0000 I STORAGE [initandlisten] WiredTiger message [1565119625:480630][1:0x7fd98507ea80], txn-recover: Main recovery loop: starting at 2/8832 to 3/256 saas-mongo | 2019-08-06T19:27:05.729+0000 I STORAGE [initandlisten] WiredTiger message [1565119625:729153][1:0x7fd98507ea80], txn-recover: Recovering log 2 through 3 saas-mongo | 2019-08-06T19:27:05.886+0000 I STORAGE [initandlisten] WiredTiger message [1565119625:886212][1:0x7fd98507ea80], txn-recover: Recovering log 3 through 3 saas-mongo | 2019-08-06T19:27:06.014+0000 I STORAGE [initandlisten] WiredTiger message [1565119626:14941][1:0x7fd98507ea80], txn-recover: Set global recovery timestamp: 0 saas-mongoexp | /docker-entrypoint.sh: line 14: /dev/tcp/saas-mongo/27017: Connection refused saas-mongoexp | Tue Aug 6 19:27:06 UTC 2019 retrying to connect to saas-mongo:27017 (3/5) saas-mongoexp | /docker-entrypoint.sh: connect: Connection refused saas-mongo | 2019-08-06T19:27:06.072+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0) saas-mongo | 2019-08-06T19:27:06.205+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘/data/db/diagnostic.data’ saas-mongoexp | /docker-entrypoint.sh: line 14: /dev/tcp/saas-mongo/27017: Connection refused saas-mongo | 2019-08-06T19:27:06.207+0000 I NETWORK [initandlisten] waiting for connections on port 27017 saas-mongo | 2019-08-06T19:27:07.126+0000 I NETWORK [listener] connection accepted from 172.20.0.3:60070 #1 (1 connection now open) saas-mongoexp | Tue Aug 6 19:27:07 UTC 2019 retrying to connect to saas-mongo:27017 (4/5) saas-mongoexp | Welcome to mongo-express saas-mongoexp | ------------------------ saas-mongoexp | saas-mongoexp | saas-mongoexp | Mongo Express server listening at http://0.0.0.0:8081 saas-mongoexp | Server is open to allow connections from anyone (0.0.0.0) saas-mongo | 2019-08-06T19:27:07.127+0000 I NETWORK [conn1] end connection 172.20.0.3:60070 (0 connections now open) saas-mongo | 2019-08-06T19:27:08.785+0000 I NETWORK [listener] connection accepted from 172.20.0.3:60072 #2 (1 connection now open) saas-mongoexp | basicAuth credentials are “admin:pass”, it is recommended you change this in your config.js! saas-mongo | 2019-08-06T19:27:08.850+0000 I NETWORK [conn2] received client metadata from 172.20.0.3:60072 conn2: { driver: { name: “nodejs”, version: “2.2.24” }, os: { type: “Linux”, name: “linux”, architecture: “x64”, version: “4.14.134-boot2docker” }, platform: “Node.js v8.16.0, LE, mongodb-core: 2.1.8” } saas-mongoexp | Database connected saas-mongoexp | { MongoError: Authentication failed. saas-mongoexp | at Function.MongoError.create (/node_modules/mongodb-core/lib/error.js:31:11) saas-mongoexp | at /node_modules/mongodb-core/lib/connection/pool.js:483:72 saas-mongoexp | at authenticateStragglers (/node_modules/mongodb-core/lib/connection/pool.js:429:16) saas-mongoexp | at Connection.messageHandler (/node_modules/mongodb-core/lib/connection/pool.js:463:5) saas-mongoexp | at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:319:22) saas-mongoexp | at emitOne (events.js:116:13) saas-mongoexp | at Socket.emit (events.js:211:7) saas-mongoexp | at addChunk (_stream_readable.js:263:12) saas-mongoexp | at readableAddChunk (_stream_readable.js:250:11) saas-mongoexp | at Socket.Readable.push (_stream_readable.js:208:10) saas-mongoexp | name: ‘MongoError’, saas-mongoexp | message: ‘Authentication failed.’, saas-mongoexp | ok: 0, saas-mongoexp | errmsg: ‘Authentication failed.’, saas-mongoexp | code: 18, saas-mongoexp | codeName: ‘AuthenticationFailed’ } saas-mongoexp | Admin Database connected saas-mongoexp | unable to list databases saas-api | $ node production-server/app.js saas-mongo | 2019-08-06T19:27:08.880+0000 I ACCESS [conn2] SASL SCRAM-SHA-1 authentication failed for root on admin from client 172.20.0.3:60072 ; UserNotFound: Could not find user root@admin saas-mongo | 2019-08-06T19:27:09.362+0000 I NETWORK [listener] connection accepted from 172.20.0.4:44914 #3 (2 connections now open) saas-mongo | 2019-08-06T19:27:09.374+0000 I NETWORK [conn3] received client metadata from 172.20.0.4:44914 conn3: { driver: { name: “nodejs”, version: “3.2.7” }, os: { type: “Linux”, name: “linux”, architecture: “x64”, version: “4.14.134-boot2docker” }, platform: “Node.js v10.16.0, LE, mongodb-core: 3.2.7” } saas-mongo | 2019-08-06T19:27:09.374+0000 I ACCESS [conn3] Supported SASL mechanisms requested for unknown user ‘saas@saas’ saas-api | info: > Ready on http://api.saas.localhost:8000 saas-api | (node:27) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [saas-mongo:27017] on first connect [MongoError: Authentication failed.] saas-api | at Pool.<anonymous> (/usr/src/api/node_modules/mongodb-core/lib/topologies/server.js:431:11) saas-api | at Pool.emit (events.js:198:13) saas-api | at Pool.EventEmitter.emit (domain.js:448:20) saas-api | at connect (/usr/src/api/node_modules/mongodb-core/lib/connection/pool.js:557:14) saas-api | at callback (/usr/src/api/node_modules/mongodb-core/lib/connection/connect.js:109:5) saas-api | at provider.auth.err (/usr/src/api/node_modules/mongodb-core/lib/connection/connect.js:352:21) saas-api | at _authenticateSingleConnection (/usr/src/api/node_modules/mongodb-core/lib/auth/auth_provider.js:66:11) saas-api | at sendAuthCommand (/usr/src/api/node_modules/mongodb-core/lib/auth/scram.js:177:16) saas-api | at Connection.messageHandler (/usr/src/api/node_modules/mongodb-core/lib/connection/connect.js:334:5) saas-api | at Connection.emit (events.js:198:13) saas-api | at Connection.EventEmitter.emit (domain.js:448:20) saas-api | at processMessage (/usr/src/api/node_modules/mongodb-core/lib/connection/connection.js:364:10) saas-api | at Socket.<anonymous> (/usr/src/api/node_modules/mongodb-core/lib/connection/connection.js:533:15) saas-api | at Socket.emit (events.js:198:13) saas-api | at Socket.EventEmitter.emit (domain.js:448:20) saas-api | at addChunk (_stream_readable.js:288:12) saas-api | (node:27) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) saas-mongo | 2019-08-06T19:27:09.394+0000 I ACCESS [conn3] SASL SCRAM-SHA-1 authentication failed for saas on saas from client 172.20.0.4:44914 ; UserNotFound: Could not find user saas@saas saas-app | $ node production-server/server/app.js saas-app | > Using external babel configuration saas-app | > Location: “/usr/src/app/.babelrc” saas-app | > Ready on http://app.saas.localhost:3000

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Moai-commented, Aug 6, 2019

Okay, I fixed the issue where I could not connect. I’m new to using Docker. To those who also couldn’t connect, you have to change your hosts file to include the following strings:

192.168.99.100          app.saas.localhost
192.168.99.100          api.saas.localhost

This got me to the login page, and I’m not sure if that means that at that point there’s still a problem. Will close the issue if I manage to get past my other config woes.

0reactions
Moai-commented, Aug 10, 2019

Ugh, I’m not sure why, but Docker is refusing to properly create network aliases for me. My hosts file now contains the following:

172.22.0.5          app.saas.localhost
172.22.0.5          api.saas.localhost

and it kind of works. I also had to use the solution outlined here (https://github.com/docker/for-win/issues/221#issuecomment-389495294). Okay… at this point, I am able to see the login screen, although it seems the API is still unreachable, because I cannot sign in either with gmail or my email. Regardless, my original issue was solved (the inability to create a user) by updating to DockerCE and Windows Professional. I’ll continue bashing my head against this… it’ll solve me tons of time if it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongodb could not find user "user@database" - Stack Overflow
The issue is that the database user is being created on the admin database instead of dbname . Omitting the /dbname from the...
Read more >
UserNotFound mongodb error
User is created at the admin -database. So,. mongo -u nameuser -p password --authenticationDatabase admin localhost:12345/mydb.
Read more >
UserNotFound: Could not find user "root" for db #403 - GitHub
I'm trying to setup mongo and mongo-express for my app. This is my docker compose file version: '3' services: node: container_name: ...
Read more >
Authentication failed for user m103-admin - MongoDB
I tried setting new password for the user m103-admin but it did not help. Any suggestions? steevej (Steeve Juneau) ...
Read more >
MongoDB: Getting started - Stackhero
If you have the error "authentication failed for admin on <database> from client <ip>; UserNotFound: Could not find user admin@<database>", it means you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found