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

Error when trying connect to Mongo instance. #275

Open
pwrdby opened this issue Aug 27, 2019 · 4 comments
Open

Error when trying connect to Mongo instance. #275

pwrdby opened this issue Aug 27, 2019 · 4 comments

Comments

@pwrdby
Copy link

pwrdby commented Aug 27, 2019

Hello !,
I'm trying run monstache:6.0.9 with ES7 and MongoDB 4.
I have these 3 applications (ES, MDB, MStache) in docker file similar like here https://github.com/rwynn/monstache-showcase.

Unfortunetly, I can't connect monstache with mongoDB, I've receved error:
ERROR 2019/08/27 17:46:46 Unable to connect to MongoDB using URL mongodb://REDACTED@mongo1:27017: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-256": (AuthenticationFailed) Authentication failed.

If I connect to mongo instance via Mongo Compass with user:password, what I use in .toml file, connection works.

I also tried a test from this repository (docker/test) and this ended with error:

`ERROR: for sut Container "c1a00a98f03d" is unhealthy.

ERROR: for monstache Container "c1a00a98f03d" is unhealthy.
ERROR: Encountered errors while bringing up the project.`

Thank You for Your time and answer!

@rwynn
Copy link
Owner

rwynn commented Aug 27, 2019

@pwrdby can you try monstache v6.1.0 recently released? It uses the latest go driver from MongoDB at v1.1.0.

If that doesn't work you may want to search the golang driver for related issues and create one yourself. Unless you can spot something wacky in the monstache code I think this would be a driver issue.

@rwynn
Copy link
Owner

rwynn commented Aug 27, 2019

Also, if the test in docker/test did not work, that might indicate some issue with docker. The test in docker/test is run by Travis CI on each commit and last was healthy. Here is the log for the latest release.

https://travis-ci.org/rwynn/monstache/jobs/574143259

@pwrdby
Copy link
Author

pwrdby commented Aug 31, 2019

@rwynn so, I tried monstache v6.1.0 and still same problem. I also tried test one again, I run only elastic service and saw the exit code 78, when I put it to the google the solution for this was here laradock/laradock#1699. Then I ran test with all services and it passed :).

But issue in my configuration was still there, so I change the root user and password, like you had set in the test and then it works! It's strange, I had in my password numbers and chars like '!' ... could be this the issue ?

@rwynn
Copy link
Owner

rwynn commented Sep 2, 2019

@pwrdby if you have special characters in your username or password you would need to url.QueryEscape those characters. For example, see the output in this go playground for what you might need to put in your config file...

https://play.golang.org/p/_jBLodshn-0

Of course, don't run with your actual creds in a go playground! Instead run go offline.

If you look at the go driver source code that interprets the URL provided in the config, you will see it does a url.QueryUnescape on both the given username and password.

https://github.com/mongodb/mongo-go-driver/blob/v1.1.0/x/mongo/driver/connstring/connstring.go#L163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants