ozomer / node-red-contrib-mongodb2

MongoDB driver node for Node-RED
Apache License 2.0
15 stars 19 forks source link

Username is preceeded with "/" #7

Open jason-a69 opened 8 years ago

jason-a69 commented 8 years ago

Hi there,

When I type in my authentication details, my username is proceeded with "/". In this example, my username to the database is pirobot

Version details ├─┬ mongodb@2.1.21 │ ├── es6-promise@3.0.2 │ ├─┬ mongodb-core@1.3.21 │ │ ├── bson@0.4.23 │ │ └─┬ require_optional@1.0.0 │ │ ├── resolve-from@2.0.0 │ │ └── semver@5.1.0 │ └─┬ readable-stream@1.0.31 │ ├── core-util-is@1.0.2 │ ├── inherits@2.0.1 │ ├── isarray@0.0.1 │ └── string_decoder@0.10.31

Remote server mongod.log file (doing the write) 2016-06-02T11:37:33.125+0100 I NETWORK [initandlisten] connection accepted from 192.168.0.5:40017 #5 (1 connection now open) 2016-06-02T11:37:37.539+0100 I ACCESS [conn5] SCRAM-SHA-1 authentication failed for /pirobot on testiot from client 192.168.0.5 ; UserNotFound: Could not find user /pirobot@testiot 2016-06-02T11:37:39.375+0100 I NETWORK [conn5] end connection 192.168.0.5:40017 (0 connections now open)

I managed to get round the issue by renaming my user to "/pirobot" but it just seems a bit odd.

Any advice is appreciated, I am happy to provide more feedback.

Many thanks

Jason

ozomer commented 8 years ago

Maybe you are using a URI with three slashes: mongodb:///host/... instead of mongodb://host/.... Are you using the username and password fields, or just the URI field?

jason-a69 commented 8 years ago

Hi Oren,

This is my configuration

Can I pass the username / password in the URI? Like this? mongodb://pirobot:@192.168.0.230:27017/testiot

Thanks for your time

Jason

On 09/06/2016 17:07, Oren Zomer wrote:

Maybe you are using a URI with three slashes: |mongodb:///host/...| instead of |mongodb://host/...|. Are you using the username and password fields, or just the URI field?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ozomer/node-red-contrib-mongodb2/issues/7#issuecomment-224840025, or mute the thread https://github.com/notifications/unsubscribe/AOa6whv51xDeijC03o3zr-Y6XSAMFgo6ks5qJ9fCgaJpZM4ItMHs.

ozomer commented 8 years ago

Yes, you can.

jason-a69 commented 8 years ago

I just tried that, same problem

2016-06-09T10:25:11.312+0100 I NETWORK [initandlisten] connection accepted from 192.168.0.4:60412 #3329 (1 connection now open) 2016-06-09T10:25:20.698+0100 I ACCESS [conn3329] Successfully authenticated as principal /pirobot on testiot

On 09/06/2016 17:31, Oren Zomer wrote:

Yes, you can.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ozomer/node-red-contrib-mongodb2/issues/7#issuecomment-224845255, or mute the thread https://github.com/notifications/unsubscribe/AOa6wrq2RPEfpZfZMDut2BEt5KMWWEftks5qJ91egaJpZM4ItMHs.

ozomer commented 8 years ago

This is very strange. You are saying it tries to login as "/pirobot" instead of "pirobot"? Please make sure that the username and password fields are empty, and only the URI field is filled. The code simply calls: mongodb.MongoClient.connect(this.uri, this.options || {}). I suggest you try calling mongodb.MongoClient.connect from node shell to see what happens.

jason-a69 commented 8 years ago

Yes it tried to connect as "/pirobot" instead of "pirobot"

So to debug this, I need to run a shell, with the command node, and try that connect statement?

On 09/06/2016 17:40, Oren Zomer wrote:

This is very strange. You are saying it tries to login as "/pirobot" instead of "pirobot"? Please make sure that the username and password fields are empty, and only the URI field is filled. The code simply calls: |mongodb.MongoClient.connect(this.uri, this.options || {})|. I suggest you try calling |mongodb.MongoClient.connect| from node shell to see what happens.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ozomer/node-red-contrib-mongodb2/issues/7#issuecomment-224847205, or mute the thread https://github.com/notifications/unsubscribe/AOa6wlFWBz_5RLHrmhBTWScYVW4nnlx-ks5qJ99ygaJpZM4ItMHs.

ozomer commented 8 years ago

Yes, try to connect normally with a mongodb client and see what happens.

jason-a69 commented 8 years ago

That works fine, very strange

On 09/06/2016 18:04, Oren Zomer wrote:

Yes, try to connect normally with a mongodb https://www.npmjs.com/package/mongodb client and see what happens.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ozomer/node-red-contrib-mongodb2/issues/7#issuecomment-224852501, or mute the thread https://github.com/notifications/unsubscribe/AOa6wsviNl9BeuA3KEqEU_ydHRUo_jEEks5qJ-UzgaJpZM4ItMHs.