Skip to content

Warnings: Unable to ensure uniqueness for usernames #2699

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
jashsayani opened this issue Sep 11, 2016 · 25 comments
Closed

Warnings: Unable to ensure uniqueness for usernames #2699

jashsayani opened this issue Sep 11, 2016 · 25 comments

Comments

@jashsayani
Copy link

I am writing a server that uses ParseServer (Express + ParseServer), and I see this when I run it:

warn: Unable to ensure uniqueness for usernames:  MongoError: not authorized for
query on mydatabase._SCHEMA

warn: Unable to ensure uniqueness for user email addresses:  MongoError: not authorized
for query on mydatabase._SCHEMA

I see that Mongo is having issues with querying the schema? Probably an indexing issue?

@haydenbleasel
Copy link

haydenbleasel commented Sep 12, 2016

I get a similar one:

warn: Unable to ensure uniqueness for usernames:  MongoError: no valid replicaset members found
warn: Unable to ensure uniqueness for user email addresses:  MongoError: no valid replicaset members found

(Express 4.14.0, Parse-Server 2.2.19, hosting DB on MLab)

@bohemima
Copy link
Contributor

MongoError: not authorized for query on mydatabase._SCHEMA

Check your username/password and that that user have the required permissions on the database.

and for @haydenbleasel MongoError: no valid replicaset members found

@bohemima
Copy link
Contributor

It's not really a question for this forum but I would check the databaseURI and make sure it's correct. Could also be a number of other issues, a search for the error gives you plenty of reading material.

@haydenbleasel
Copy link

haydenbleasel commented Sep 12, 2016

The databaseURI is definitely correct, I have done a massive search and it's not yielding much luck. I believe it might be coupled with #2580 since I get this straight after:

/Users/haydenbleasel/Documents/Projects/x/node_modules/parse-server/lib/ParseServer.js:405
            throw err;
            ^

Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:346:11)
    at ServerResponse.header (/Users/haydenbleasel/Documents/Projects/x/node_modules/express/lib/response.js:719:10)
    at ServerResponse.send (/Users/haydenbleasel/Documents/Projects/x/node_modules/express/lib/response.js:164:12)
    at done (/Users/haydenbleasel/Documents/Projects/x/node_modules/express/lib/response.js:956:10)
    at Immediate._onImmediate (/Users/haydenbleasel/Documents/Projects/x/node_modules/express-handlebars/lib/utils.js:26:13)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

Update: Appears to be more related to #2446.

@flovilmart
Copy link
Contributor

Are you using version 2.2.19?

@haydenbleasel
Copy link

@flovilmart Yep as mentioned above 👍

@flovilmart
Copy link
Contributor

The headers already sent error should not yield in 2.2.19 as we removed the next() calls on success. You probably have a middleware for handling errors.

For the databaseURI problem, that's probably related to the issue you mentioned but I don't have that error myself, and can properly connect to the replicaset. Do you have any special chars in your username/password?

@haydenbleasel
Copy link

My username field is the same as the email field at the moment (so we can log in with email). Perhaps the @ character?

@flovilmart
Copy link
Contributor

flovilmart commented Sep 12, 2016

Yeah... that may interfere with the URL parser as it will see 2 @'s.

@ and : can be problematic for some URL parsers when providing username/pass inline.

Like:

@haydenbleasel
Copy link

Oh sorry I thought you meant my actual app login haha. No my database user / pass doesn't have any special characters. BTW, this issue just got resolved for me. It works at home but not at the office. Weird.

@flovilmart
Copy link
Contributor

that's odd. And from the office, you can connect correctly to the DB from the CLI?

@haydenbleasel
Copy link

I just got home and everything's working correctly. From the office all day (no code changes since then), I've had the two errors mentioned above (MongoError and Can't Set Headers). The DB connection from CLI is kinda sketchy - their firewall is pretty intense though (university).

@flovilmart
Copy link
Contributor

So, get yourself a VPN or a remote server when working from the uni :)

@haydenbleasel
Copy link

Yep my bad haha, problem solved.

@flovilmart
Copy link
Contributor

Glad you found the solution! Closing

@flovilmart
Copy link
Contributor

Is there any logs that mongo would provide so you can drill down that issue? That is highly unlikely to be an issue with parse-server itself, but probably with your authentication mechanism with mongo.

@sitemart
Copy link

Usually happens behind a proxy or if you are working locally without an active internet connection which is somehow weird to me.

@jashsayani
Copy link
Author

I am still seeing this error - password has some special characters like }{ and a^ and \1, etc.

@flovilmart
Copy link
Contributor

@jashsayani can you update your password without special chars?

@jashsayani
Copy link
Author

@jashsayani can you update your password without special chars?

I am not sure if removing special characters from the password is a move in the right direction. Its generated by mLab and used by the hosted Parse solution for writing data thats sent to api.parse.com, and not having special characters in the password is a bad move.

@flovilmart
Copy link
Contributor

I'm asking that to see if there is an encoding problem with the mondo DB URL. We pass that URL directly to the MongoDB node module and should not apply any transformation. Can you connect to the database with the same URL with the MongoDB node module?

@jashsayani
Copy link
Author

Seems to be working with: https://github.com/rsercano/mongoclient

I believe it uses the Mongo node module.

@flovilmart
Copy link
Contributor

flovilmart commented Sep 24, 2016

Not the same version though, the module you suggest is using 2.1.18, we're at 2.2.10. You'd need to try directly with mongo client version 2.2.10.

@gorockymin
Copy link

gorockymin commented Dec 7, 2016

Recently, I updated parse server to 2.2.25 and set mongoDB with replication set.
In databaseURI configuration, I set the following link:

mongodb://username:pwd@ip1:port,ip2:port,ip3:port/db?replicaSet=rs-db

It's same as the Parse.com migration setup and no problem.
However, it doesn't work in the parse-server open source.

The error message is here.

warn: Unable to ensure uniqueness for usernames:  domain=null

@flovilmart
Copy link
Contributor

Closing due to lack of activity, please update to latest parse-server version and open a new issue if the issue persist.

Don't forget to include your current:

  • node version
  • npm version
  • parse-server version
  • any relevant logs (VERBOSE=1 will enable verbose logging)

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

6 participants