mdn / express-locallibrary-tutorial

Local Library website written in NodeJS/Express; example for the MDN server-side development NodeJS module: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when doing node populatedb

rtw590 opened this issue · comments

Hello, I'm having an issue with populating the database from part 3.

  • I added populatedb.js to my root directory
  • I ran npm install async --save in my root directory
  • Then, I ran the code below

I guessed that maybe I just had my database username put in incorrectly or the password, but I even made a second user and tried that out and it still gave me these results.

Any help is appreciated!

node populatedb mongodb://my-db-username:my-db-password@ds131698.mlab.com:31698/local_library
This script populates some test books, authors, genres and bookinstances to your database. Specified database as argument - e.g.: populatedb mongodb://your_username:your_password@your_dabase_url
MongoDB connection error: { MongoError: Authentication failed.
    at /home/rob/express-local-library/express-locallibrary-tutorial/node_modules/mongodb-core/lib/connection/pool.js:595:61
    at authenticateStragglers (/home/rob/express-local-library/express-locallibrary-tutorial/node_modules/mongodb-core/lib/connection/pool.js:513:16)
    at Connection.messageHandler (/home/rob/express-local-library/express-locallibrary-tutorial/node_modules/mongodb-core/lib/connection/pool.js:549:5)
    at emitMessageHandler (/home/rob/express-local-library/express-locallibrary-tutorial/node_modules/mongodb-core/lib/connection/connection.js:309:10)
    at Socket.<anonymous> (/home/rob/express-local-library/express-locallibrary-tutorial/node_modules/mongodb-core/lib/connection/connection.js:452:17)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:594:20)
  name: 'MongoError',
  message: 'Authentication failed.',
  ok: 0,
  errmsg: 'Authentication failed.',
  code: 18,
  codeName: 'AuthenticationFailed' }
(node:2616) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): MongoError: Authentication failed.
(node:2616) [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.

I tried this recently so I know it works. Does your password actually have hypens? Try something silly like user1 password1

Also try this project synced from github to see if it works on the vanilla version.

I'll be doing some work on the project on Friday, so will look for your responses then.

Thank you for the reply!

My password only had lowercase, caps, numbers, and exclamation points, but it does seem like it was something there because I added a user1 with password 1 and that worked to populate the database.

Thank you for the help here and thank you for your work on this project!

That's odd, but great you have it working :-)