Skip to content

Mongo db v3.4 seems to be causing parse server authentication errors #5659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
OpConTech opened this issue Jun 10, 2019 · 6 comments
Closed

Comments

@OpConTech
Copy link

Hi Parse Server Team,

Tomorrow Mongo is forcing updates from v3.2 to v3.4.

I have been trying to test Parse Server v3.2.3 with Mongo v3.4.
When I run this config Parse Server is not crashing but is having lots of recurring warnings.

Issue Description

There are multiple warnings in the error log on start up:
warn: Unable to ensure uniqueness for usernames: message=Authentication failed., stack=MongoError: Authentication failed.

I looked at issue #2269 - Warnings: Unable to ensure uniqueness for usernames
#2699
but that issue never did get to the root cause. Also FYI my mongo db username is not email and does not have any special characters alike @.

I am using the same mongo username and PW on both v3.2 and 3.4 instances as I am trying to make sure all the config on both is the same. I have checked and rechecked to make sure that I am setting databaseURI correctly in package.json. Maybe Parse Server is having an issue authenticating because mongo 3.4 has made a change to the authentication api? I

Steps to reproduce

Load Parse Server v3.2.3 using mongo db v3.4.20

Expected Results

Run normally.

Actual Outcome

Lots of warnings in the log and Parse server is unstable.

Environment Setup

  • Server

    • parse-server version 3.2.3
    • Operating System: OSX
    • Hardware: Mac
    • Localhost or remote server? Heroku
  • Database

    • MongoDB version: 3.4.20
    • Storage engine: ?
    • Hardware: ?
    • Localhost or remote server? AWS

Logs/Trace

Here are some of the Error Log issues immediately after the Parse Server starts:

Jun 10 10:30:30 calm-badlands-34164 app/web.1: info: Parse LiveQuery Server starts running
Jun 10 10:30:30 calm-badlands-34164 app/web.1: warn: Unable to ensure uniqueness for usernames: message=Authentication failed., stack=MongoError: Authentication failed.
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at Function._getError (/app/node_modules/mongodb-core/lib/auth/scram.js:125:14)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at /app/node_modules/mongodb-core/lib/auth/scram.js:175:31
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at Connection.messageHandler (/app/node_modules/mongodb-core/lib/connection/connect.js:334:5)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at Connection.emit (events.js:200:13)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at Connection.EventEmitter.emit (domain.js:471:20)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at processMessage (/app/node_modules/mongodb-core/lib/connection/connection.js:364:10)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at TLSSocket. (/app/node_modules/mongodb-core/lib/connection/connection.js:533:15)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at TLSSocket.emit (events.js:200:13)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at TLSSocket.EventEmitter.emit (domain.js:471:20)
Jun 10 10:30:30 calm-badlands-34164 app/web.1: at addChunk (_stream_readable.js:294:12), name=MongoError
Jun 10 10:30:30 calm-badlands-34164 app/web.1: warn: Unable to ensure uniqueness for user email addresses: message=Authentication failed., stack=MongoError: Authentication failed.

@acinader
Copy link
Contributor

I believe that you are getting this because parse-server is failing to connect to your mongo. The unhelpful message is just when the first operation attempted during server startup fails.

You should double and triple check your connection string, db username and password, port, etc.

@OpConTech
Copy link
Author

acinader thanks for reaching out. I agree completely.

It seems to the a problem with mongo v3.4 not v3.2.
I am very concerned because tomorrow mongo is forcing an auto update from my current 3.2 to v3.4.
"This deployment will be auto-upgraded to MongoDB 3.4 after June 11, 2019".

So right now my 3.2 runs fine with Parse Server but I can not get Parse Server to correctly authenticate with mongo v3.4

@acinader
Copy link
Contributor

acinader commented Jun 10, 2019

@OpConTech I do not believe that this is a parse issue.

We don't test specifically against v3.4 (or 3.2 for that matter.) We test against 3.6.9 and 4.0.4 (you can see here: https://travis-ci.org/parse-community/parse-server).

However, I strongly suspect that this is a configuration issue on your part (sorry to say ;)).

Validate your connection string programmatically by connecting independently of parse server. Make sure you take the connection string from the config output when you start the server. Is the user and its credentials properly configured on the new db; is new db server reachable from the parse host, etc. etc.

can you enable logging on the database server? Can you see the client connect?

@OpConTech
Copy link
Author

Perhaps is has to do with the fact that Mongo changes the User Role permissions in v3.4

Compatibility Changes in MongoDB 3.4
User Role Changes
https://docs.mongodb.com/manual/release-notes/3.4-compatibility/#user-roles-changes

@OpConTech
Copy link
Author

Oh ok. I did not know that you were testing with v3.6.
I will look harder and check the client connection on the mongo side as you suggest.

@OpConTech
Copy link
Author

@acinader thanks to you letting me know that Parse Server tests with 3.6 and 4.0 I had more confidence that it was a config issue on my end.

I was focused on the username and pw but if you look carefully the copied link from a mongo instance also leaves the name of the database blank . Once I replaced that with my database name I was able to correctly get Parse Server to connect to mongo v3.4.

mongodb://dbuser:dbpassword@ds235717-ax.rrrr99.geronomot.mlab.com:333333,ds171717171-a1.cwn70.fleet.mlab.com:35717/dbname?replicaSet=rs-ds171717171&ssl=true

mongodb://sampleusername:[email protected]:333333,ds171717171-a1.cwn70.fleet.mlab.com:35717/dontForgetYourDbNameHere?replicaSet=rs-ds171717171&ssl=true

So no mongo 3.4 issue and this thread is ready to close.

Thank you for your help and collaboration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants