MongoError: Authentication failed.
ruben-farma opened this issue · 2 comments
Hi,
When I pass the STEIN_MONGO_URL=mongodb://Xxxx:xxxx@10.1.0.2:27017
Stein is creating a mongodb database named test and working correctly.
But when I try with DB /stein STEIN_MONGO_URL=mongodb://Xxxx:xxxx@10.1.0.2:27017/stein
I have the next error:
(node:53) DeprecationWarning: 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.
MongoError: Authentication failed.
cross-env STEIN_MONGO_URL=mongodb://XX@10.1.0.2:27017 STEIN_CLIENT_ID=XXXX.apps.googleusercontent.com STEIN_CLIENT_SECRET=XXXSTEIN_CALLBACK_URL=http://stein.XXX.com/auth/google/callback STEIN_SESSION_SECRET=xxxx stein start
I Tested without creating the DB and creating previusly the DB with the same user and always I have the same error.
I can't comment on the exact configuration, but as a first step, do these links help?
- Automattic/mongoose#4587
- https://stackoverflow.com/questions/30105823/mongoerror-auth-failed-mongoose-connection-sting
A common error that appears to be popping up is not specifying the auth source. Is this the problem?
Many thanks, this answer helps me!
Automattic/mongoose#4587 (comment)
Now I used the next string:
STEIN_MONGO_URL='mongodb://user:pw@10.1.0.2:27017/stein?authSource=admin&w=1'
The '
next to the = and at the end it's important to scape the ? and & characters in the URI.
Maybe can be good to add this to the Docs for further use!