huggingface/Mongoku

Replica set

Lianidaz opened this issue · 13 comments

Attempt to connect to replica set ejaculates "Malformed URL" error. And I'm not even trying to pass any options

Works for us, but we're gonna look into it, cc @n1t0

can you paste an example of the format string you try to use?

mongodb://user:pass@replica1.gcp.mongodb.net:27017,replica2.gcp.mongodb.net:27017,replica3.gcp.mongodb.net:27017/admin

Or the SRV method:

mongodb+srv://user:password@replicaset.gcp.mongodb.net/admin

Don't have srv method unfortunately, lousy cloud.
My connection string goes like this
mongodb://us3r:pa$$@192.168.100.23:3223,192.168.100.38:3223,192.168.100.155:3223/cool_prod_db?replicaSet=replica

I know it's quite an obscure way to connect, but this case would benefit at least 40 devs and testers.

n1t0 commented

I just published a new version that is more permissive with the URL format. As long as the mongodb driver accepts it, it should work fine. Let me know

I'm still having trouble connecting to a replica set on MongoDB Atlas.

[Mongoku] listening on port 3100 [obfuscated.gcp.mongodb.net] Connected to obfuscated.gcp.mongodb.net Error while connecting to obfuscated.gcp.mongodb.net: undefined Server does not exist (node:14136) UnhandledPromiseRejectionWarning: MongoError: user is not allowed to do action [collStats] on [admin.system.roles] at Connection.<anonymous> (C:\Users\Frederic Houle\AppData\Roaming\npm\node_modules\mongoku\node_modules\mongodb-core\lib\connection\pool.js:443:61) at Connection.emit (events.js:197:13) at processMessage (C:\Users\Frederic Houle\AppData\Roaming\npm\node_modules\mongoku\node_modules\mongodb-core\lib\connection\connection.js:364:10) at TLSSocket.<anonymous> (C:\Users\Frederic Houle\AppData\Roaming\npm\node_modules\mongoku\node_modules\mongodb-core\lib\connection\connection.js:533:15) at TLSSocket.emit (events.js:197:13) at addChunk (_stream_readable.js:288:12) at readableAddChunk (_stream_readable.js:269:11) at TLSSocket.Readable.push (_stream_readable.js:224:10) at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:145:17) (node:14136) 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: 4) (node:14136) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

n1t0 commented

This seems to be an error related to the permissions your user has. As you can see in your error message, it first connects, and then when it tries to issue a collStats command, you get this error.

Can you try using the same URL but without the /admin part?

n1t0 commented

You can also try what we discussed here: #3

Let me know how it works. If it doesn't, can you give me more information about the roles of your user, mongo version your server is running, etc...

So.
I pulled latest image. It now allows me to add server with that monstrous string. But it shows only first host of the set and Authentication failed.
Credentials are fine of course.

@n1t0 You could possibly spin up a free MongoDB Atlas replica set, and see by yourself? We're using the free one, without any customization. Tried without the /admin at the end of the URL, without success.

This seems to be an error related to the permissions your user has. As you can see in your error message, it first connects, and then when it tries to issue a collStats command, you get this error.

Can you try using the same URL but without the /admin part?

n1t0 commented

Awesome thank you! I'll have a look

n1t0 commented

This should now be fixed in the new release

Fixed indeed. Thank you!