Skip to content
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

3.4.1 throws error if using mLab, due to changes to MongoStorageAdapter.performInitialization #5678

Closed
ghost opened this issue Jun 13, 2019 · 3 comments · Fixed by #5683
Closed

Comments

@ghost
Copy link

ghost commented Jun 13, 2019

Issue Description

When running the latest version of parse-server (3.4.1) an Error is thrown if using a database hosted in mLab, and the application fails to start.

This seems to happen due to a change for MongoStorageAdapter, where the performInitialization method now tries to run the serverStatus MongoDB command.

Since mLab doesn't allow running this command the following Error is thrown:

{ MongoError: not authorized on admin to execute command { serverStatus: 1 }}

Unfortunately it doesn't look like it's possible to re-configure the mLab database to allow this request, making it impossible to run the latest version of parse-server together with it.

Steps to reproduce

  1. Setup a database in mLab OR setup a user in a MongoDB database that does not have the permissions to the run serverStatus command.
  2. Run parse-server 3.4.1.
  3. The error should be thrown shortly after Parse-Server has been initialized.

Expected Results

  1. Successful connection to the MongoDB database.

Actual Outcome

  1. parse-server throws an Error due to missing permissions for the MongoDB database.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.4.1
    • Operating System: Amazon Linux
    • Hardware: t3.medium
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS
  • Database

    • MongoDB version: 3.4.20
    • Storage engine: WiredTiger
    • Hardware: M1 High Storage (2 GB RAM, 75 GB SSD block storage)
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

Logs/Trace

{ MongoError: not authorized on admin to execute command { serverStatus: 1, lsid: { id: UUID("7de8356e-0ccc-4383-acd9-ff73151a3c1e") }, $clusterTime: { clusterTime: Timestamp(1560430864, 2), signature: { hash: BinData(0, 5DBD8DCDE92F92F253CC5B530C41476F41792CC5), keyId: 6662117802268164097 } }, $db: "admin" }
    at Connection.<anonymous> (C:\src\plejd\cloud-server\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:443:61)
    at Connection.emit (events.js:189:13)
    at Connection.EventEmitter.emit (domain.js:441:20)
    at processMessage (C:\src\plejd\cloud-server\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:364:10)
    at Socket.<anonymous> (C:\src\plejd\cloud-server\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:533:15)
    at Socket.emit (events.js:189:13)
    at Socket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at Socket.Readable.push (_stream_readable.js:220:10)
  operationTime:
   Timestamp { _bsontype: 'Timestamp', low_: 2, high_: 1560430864 },
  ok: 0,
  errmsg:
   'not authorized on admin to execute command { serverStatus: 1, lsid: { id: UUID("7de8356e-0ccc-4383-acd9-ff73151a3c1e") }, $clusterTime: { clusterTime: Timestamp(1560430864, 2), signature: { hash: BinData(0, 5DBD8DCDE92F92F253CC5B530C41476F41792CC5), keyId: 6662117802268164097 } }, $db: "admin" }',
  code: 13,
  codeName: 'Unauthorized',
  '$clusterTime':
   { clusterTime:
      Timestamp { _bsontype: 'Timestamp', low_: 2, high_: 1560430864 },
     signature: { hash: [Binary], keyId: [Long] } },
  name: 'MongoError',
  [Symbol(mongoErrorContextSymbol)]: {} }
@ghost
Copy link
Author

ghost commented Jun 13, 2019

This seems to be related to this PR from 10 days ago:

And to this commit:

@acinader
Copy link
Contributor

@BenniPlejd

In my haste to get out the security fix yesterday, I made the mistake of adding the patch to master instead of to 3.4.0. I'll get 3.4.2 ready now to resolve this, and then we can figure out what to do about #5627.

@fmendoza
Copy link

Same issue on a VPS hosted on DO. Glad to hear you identify the issue quickly

dplewis added a commit that referenced this issue Jun 13, 2019
dplewis added a commit that referenced this issue Jun 13, 2019
This reverts commit 106b6dd.
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this issue Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants