Tuesday 14 March 2017

Cannot push Node app to Heroku because MongoDB Authentication Error

I want to deploy my app to heroku using mlab as a service. When I push to heroku and check my heroku logs, I get the error:

MongoError: Authentication failed.

I did some research and it seems to be because my MongoDB shell and server versions don't match. When I try to connect using the mongo shell by typing:

mongo ds129610.mlab.com:29610/heroku_tnswz69w -u <dbuser> -p <dbpassword>

I get:

MongoDB shell version v3.4.2
connecting to: mongodb://ds129610.mlab.com:29610/heroku_tnswz69w
MongoDB server version: 3.2.12
WARNING: shell and server versions do not match
2017-03-14T16:06:21.842-0700 E QUERY    [thread1] Error: Authentication       failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1459:20
@(auth):6:1
@(auth):1:2
exception: login failed

I've tried to upgrade my server version, but I have not been successful. How can I resolve this issue? Here are my heroku logs, just in case that this isn't the only issue:

2017-03-14T20:14:44.000000+00:00 app[api]: Build succeeded
2017-03-14T20:14:59.777446+00:00 app[api]: Release v9 created by user corey.archharr@gmail.com
2017-03-14T20:14:59.941332+00:00 heroku[web.1]: State changed from crashed
to starting
2017-03-14T20:15:02.970234+00:00 heroku[web.1]: Starting process with command `node server.js`
2017-03-14T20:15:05.774946+00:00 app[web.1]: 
2017-03-14T20:15:05.774962+00:00 app[web.1]: events.js:160
2017-03-14T20:15:05.774963+00:00 app[web.1]:       throw er; // Unhandled 'error' event
2017-03-14T20:15:05.774964+00:00 app[web.1]:       ^
2017-03-14T20:15:05.776680+00:00 app[web.1]: MongoError: Authentication failed.
2017-03-14T20:15:05.776682+00:00 app[web.1]:     at Function.MongoError.create (/app/node_modules/mongodb-core/lib/error.js:31:11)
2017-03-14T20:15:05.776683+00:00 app[web.1]:     at /app/node_modules/mongodb-core/lib/connection/pool.js:483:72
2017-03-14T20:15:05.776684+00:00 app[web.1]:     at authenticateStragglers (/app/node_modules/mongodb-core/lib/connection/pool.js:429:16)
2017-03-14T20:15:05.776685+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:319:22)
2017-03-14T20:15:05.776685+00:00 app[web.1]:     at Connection.messageHandler (/app/node_modules/mongodb-core/lib/connection/pool.js:463:5)
2017-03-14T20:15:05.776686+00:00 app[web.1]:     at emitOne (events.js:96:13)
2017-03-14T20:15:05.776687+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
2017-03-14T20:15:05.776688+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2017-03-14T20:15:05.776689+00:00 app[web.1]:     at TCP.onread (net.js:548:20)
2017-03-14T20:15:05.776688+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
2017-03-14T20:15:05.851998+00:00 heroku[web.1]: Process exited with status 1
2017-03-14T20:15:05.849610+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-14T20:15:05.850669+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-14T20:15:09.046484+00:00 heroku[web.1]: Starting process with command `node server.js`
2017-03-14T20:15:12.712501+00:00 heroku[web.1]: Process exited with status 1
2017-03-14T20:15:12.632012+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:319:22)
2017-03-14T20:15:12.630846+00:00 app[web.1]: 
2017-03-14T20:15:12.632015+00:00 app[web.1]:     at TCP.onread (net.js:548:20)
2017-03-14T20:15:12.630864+00:00 app[web.1]: events.js:160
2017-03-14T20:15:12.632013+00:00 app[web.1]:     at emitOne (events.js:96:13)
2017-03-14T20:15:12.630866+00:00 app[web.1]:       throw er; // Unhandled 'error' event
2017-03-14T20:15:12.632014+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2017-03-14T20:15:12.630866+00:00 app[web.1]:       ^
2017-03-14T20:15:12.632015+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
2017-03-14T20:15:12.632008+00:00 app[web.1]: MongoError: Authentication failed.
2017-03-14T20:15:12.632013+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
2017-03-14T20:15:12.632010+00:00 app[web.1]:     at Function.MongoError.create (/app/node_modules/mongodb-core/lib/error.js:31:11)
2017-03-14T20:15:12.632011+00:00 app[web.1]:     at /app/node_modules/mongodb-core/lib/connection/pool.js:483:72
2017-03-14T20:15:12.632011+00:00 app[web.1]:     at authenticateStragglers (/app/node_modules/mongodb-core/lib/connection/pool.js:429:16)
2017-03-14T20:15:12.632012+00:00 app[web.1]:     at Connection.messageHandler (/app/node_modules/mongodb-core/lib/connection/pool.js:463:5)
2017-03-14T20:15:12.729762+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-14T20:15:54.013766+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=thawing-chamber-22079.herokuapp.com request_id=13034e5e-049a-42c6-a0b7-37c3f769d416 fwd="209.49.17.173" dyno= connect= service= status=503 bytes= protocol=https
2017-03-14T20:15:54.509374+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=thawing-chamber-22079.herokuapp.com request_id=f0c7f03e-db03-4efc-ba84-cb21e79d31d8 fwd="209.49.17.173" dyno= connect= service= status=503 bytes= protocol=https
2017-03-14T20:18:26.328705+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=thawing-chamber-22079.herokuapp.com request_id=59a6218c-44ef-4c69-b712-173c6b438782 fwd="209.49.17.173" dyno= connect= service= status=503 bytes= protocol=https
2017-03-14T20:18:26.757058+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=thawing-chamber-22079.herokuapp.com request_id=59c15c21-f2b2-4266-b5c7-2c7367e4c136 fwd="209.49.17.173" dyno= connect= service= status=503 bytes= protocol=https
2017-03-14T20:42:56.872743+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-14T20:43:00.417848+00:00 heroku[web.1]: Starting process with command `node server.js`
2017-03-14T20:43:03.592709+00:00 app[web.1]: 
2017-03-14T20:43:03.592728+00:00 app[web.1]: events.js:160
2017-03-14T20:43:03.592729+00:00 app[web.1]:       throw er; // Unhandled 'error' event
2017-03-14T20:43:03.592730+00:00 app[web.1]:       ^
2017-03-14T20:43:03.593930+00:00 app[web.1]: MongoError: Authentication failed.
2017-03-14T20:43:03.593932+00:00 app[web.1]:     at Function.MongoError.create (/app/node_modules/mongodb-core/lib/error.js:31:11)
2017-03-14T20:43:03.593933+00:00 app[web.1]:     at /app/node_modules/mongodb-core/lib/connection/pool.js:483:72
2017-03-14T20:43:03.593933+00:00 app[web.1]:     at authenticateStragglers (/app/node_modules/mongodb-core/lib/connection/pool.js:429:16)
2017-03-14T20:43:03.593934+00:00 app[web.1]:     at Connection.messageHandler (/app/node_modules/mongodb-core/lib/connection/pool.js:463:5)
2017-03-14T20:43:03.593934+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:319:22)
2017-03-14T20:43:03.593935+00:00 app[web.1]:     at emitOne (events.js:96:13)
2017-03-14T20:43:03.593935+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
2017-03-14T20:43:03.593936+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2017-03-14T20:43:03.593936+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
2017-03-14T20:43:03.593937+00:00 app[web.1]:     at TCP.onread (net.js:548:20)
2017-03-14T20:43:03.686941+00:00 heroku[web.1]: Process exited with status 1
2017-03-14T20:43:03.707557+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-14T21:40:18.936675+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-14T21:40:21.858760+00:00 heroku[web.1]: Starting process with command `node server.js`
2017-03-14T21:40:25.337623+00:00 heroku[web.1]: Process exited with status 1
2017-03-14T21:40:25.209569+00:00 app[web.1]: 
2017-03-14T21:40:25.209587+00:00 app[web.1]: events.js:160
2017-03-14T21:40:25.209589+00:00 app[web.1]:       throw er; // Unhandled 'error' event
2017-03-14T21:40:25.209590+00:00 app[web.1]:       ^
2017-03-14T21:40:25.211925+00:00 app[web.1]: MongoError: Authentication failed.
2017-03-14T21:40:25.211928+00:00 app[web.1]:     at Function.MongoError.create (/app/node_modules/mongodb-core/lib/error.js:31:11)
2017-03-14T21:40:25.211930+00:00 app[web.1]:     at authenticateStragglers (/app/node_modules/mongodb-core/lib/connection/pool.js:429:16)
2017-03-14T21:40:25.211929+00:00 app[web.1]:     at /app/node_modules/mongodb-core/lib/connection/pool.js:483:72
2017-03-14T21:40:25.211931+00:00 app[web.1]:     at Connection.messageHandler (/app/node_modules/mongodb-core/lib/connection/pool.js:463:5)
2017-03-14T21:40:25.211931+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:319:22)
2017-03-14T21:40:25.211932+00:00 app[web.1]:     at emitOne (events.js:96:13)
2017-03-14T21:40:25.211932+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
2017-03-14T21:40:25.211933+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2017-03-14T21:40:25.211934+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
2017-03-14T21:40:25.211934+00:00 app[web.1]:     at TCP.onread (net.js:548:20)
2017-03-14T21:40:25.353825+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-14T23:09:56.515355+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-14T23:09:59.150824+00:00 heroku[web.1]: Starting process with command `node server.js`
2017-03-14T23:10:01.803320+00:00 heroku[web.1]: Process exited with status 1
2017-03-14T23:10:01.745328+00:00 app[web.1]: 
2017-03-14T23:10:01.745344+00:00 app[web.1]: events.js:160
2017-03-14T23:10:01.745349+00:00 app[web.1]:       throw er; // Unhandled 'error' event
2017-03-14T23:10:01.745349+00:00 app[web.1]:       ^
2017-03-14T23:10:01.746159+00:00 app[web.1]: MongoError: Authentication failed.
2017-03-14T23:10:01.746161+00:00 app[web.1]:     at Function.MongoError.create (/app/node_modules/mongodb-core/lib/error.js:31:11)
2017-03-14T23:10:01.746162+00:00 app[web.1]:     at /app/node_modules/mongodb-core/lib/connection/pool.js:483:72
2017-03-14T23:10:01.746163+00:00 app[web.1]:     at authenticateStragglers (/app/node_modules/mongodb-core/lib/connection/pool.js:429:16)
2017-03-14T23:10:01.746163+00:00 app[web.1]:     at Connection.messageHandler (/app/node_modules/mongodb-core/lib/connection/pool.js:463:5)
2017-03-14T23:10:01.746164+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:319:22)
2017-03-14T23:10:01.746165+00:00 app[web.1]:     at emitOne (events.js:96:13)
2017-03-14T23:10:01.746165+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
2017-03-14T23:10:01.746166+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2017-03-14T23:10:01.746167+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
2017-03-14T23:10:01.746167+00:00 app[web.1]:     at TCP.onread (net.js:548:20)
2017-03-14T23:10:01.820453+00:00 heroku[web.1]: State changed from starting to crashed



via Corey Harrilal

No comments:

Post a Comment