-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Parse does not re-authorize connection to MongoDB #3775
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
Comments
@MihalySzabo what do you suggest we should do? invalidate the connection on errors? |
@flovilmart I do not know the exact state transitions of Parse's connection handling, but I think invalidating connection on errors in general would not be a good solution, because a query can also raise an error even if the connection is OK. If the Mongo user has a read only access to the DB, that also raises a "not authorised" exception (?) on a write, but still nothing is wrong with the connection. Maybe an error callback would be nice where the developer could decide what to do with the error with a return of an instruction what Parse should do, e.g.: {'invalidateConnection':true} or {'retryInMillisecs': 1000}. On the other hand have you any idea why the one direction works as expected (if Mongo user is deleted, Parse cannot access DB), but not the other (Mongo user is put back, but Parse is still unauthorised)? |
Uhh I'm not sure why, this is probably inside the mongodb driver, not sure about that. We can probably find something for the error handling, removing / closing the connection so it's re-established next time. |
Closed via #4576 |
Issue Description
If the user that Parse uses to connect to MongoDB is deleted, Parse will not be able to fetch any data from the DB - as expected. But if the user is put back, Parse will still not get any data until restart.
Steps to reproduce
Expected Results
Parse should continue to access MongoDB normally.
Actual Outcome
Parse throws errors until restart.
Environment Setup
Server
Database
Logs/Trace
error: Uncaught internal server error. { MongoError: not authorized on to execute command { find: "_SCHEMA", filter: {} }
at Function.MongoError.create (/var/app/current/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/var/app/current/node_modules/mongodb-core/lib/cursor.js:212:36)
at /var/app/current/node_modules/mongodb-core/lib/connection/pool.js:461:18
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
name: 'MongoError',
message: 'not authorized on to execute command { find: "_SCHEMA", filter: {} }',
ok: 0,
errmsg: 'not authorized on to execute command { find: "_SCHEMA", filter: {} }',
code: 13 } MongoError: not authorized on to execute command { find: "_SCHEMA", filter: {} }
at Function.MongoError.create (/var/app/current/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/var/app/current/node_modules/mongodb-core/lib/cursor.js:212:36)
at /var/app/current/node_modules/mongodb-core/lib/connection/pool.js:461:18
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
MongoError: not authorized on to execute command { find: "_SCHEMA", filter: {} }
at Function.MongoError.create (/var/app/current/node_modules/mongodb-core/lib/error.js:31:11)
at queryCallback (/var/app/current/node_modules/mongodb-core/lib/cursor.js:212:36)
at /var/app/current/node_modules/mongodb-core/lib/connection/pool.js:461:18
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
The text was updated successfully, but these errors were encountered: