mariano-fiorentino / amid

Another.js MongoDb Internet Driver
GNU Lesser General Public License v3.0
48 stars 11 forks source link

Cannot call method 'replace' of undefined in mongodb_scram.js #6

Open chupasaurus opened 9 years ago

chupasaurus commented 9 years ago

Mongodb 3, mongodb node.js driver version 1.4.35 Call trace: /home/nikita/node_modules/amid/node_modules/mongodb/lib/mongodb/db.js:299 throw err; ^ TypeError: Cannot call method 'replace' of undefined at executeScram (/home/nikita/node_modules/amid/node_modules/mongodb/lib/mongodb/auth/mongodb_scram.js:34:27) at authenticate (/home/nikita/node_modules/amid/node_modules/mongodb/lib/mongodb/auth/mongodb_scram.js:184:5) at Db.authenticate (/home/nikita/node_modules/amid/node_modules/mongodb/lib/mongodb/db.js:756:7) at /home/nikita/node_modules/amid/lib/rest.js:85:16 at /home/nikita/node_modules/amid/node_modules/mongodb/lib/mongodb/db.js:296:11 at process._tickCallback (node.js:415:13)

mariano-fiorentino commented 9 years ago

Hello, have you turned on security in your mongodb? In this case you can try to replace at line 85 of /home/nikita/node_modules/amid/lib/rest.js:

db.authenticate(req.query.username, req.query.password, function callback(){

with:

db.authenticate(config.db.username, config.db.password, function callback(){

Tell me if this works

jschaeke commented 9 years ago

Had same issue, solved it by adding username and password (with empty strings as value) to config file...

mariano-fiorentino commented 9 years ago

Hi , do you have this issue using this conf in mongo.conf?

auth = true

Or in your configuration auth=false? What version of mongodb do you have?

Regards

jschaeke commented 9 years ago

just added it to the config.json file of amid using mongodb 3.0.5: "db": { "port": 27017, "host": "127.0.0.1", "username" : "", "password" : "" }

mariano-fiorentino commented 9 years ago

Your /etc/mongo.conf have this line? auth = true

jschaeke commented 9 years ago

I have only a mongod.conf and it doesn't contain any auth parameters (just systemLog, storage and net)

mariano-fiorentino commented 9 years ago

Ok, understood the problem. As soon as possibile i'll make a new release with the fix.

Regards

On Fri, Sep 11, 2015 at 3:36 PM, jschaeke notifications@github.com wrote:

I have only a mongod.conf and it doesn't contain any auth parameters (just systemLog, storage and net)

— Reply to this email directly or view it on GitHub https://github.com/mariano-fiorentino/amid/issues/6#issuecomment-139547852 .