Skip to content

Error not handle properly MongoError: quota exceeded  #5005

Closed
@jadhavmanoj

Description

@jadhavmanoj

Issue Description:
Database server raised an error MongoError: quota exceeded. It is not handle in parse server.

Expected Results:
Parse server should throw this error. Parse server expecting Error object but there is no check for it. mongo server throws string as MongoError: quota exceeded.

Actual Outcome:
Exact error should be logged

Environment Setup

  • Server
    • parse-server version (Be specific! Don't say 'latest'.) : 2.7
    • Operating System: ubuntu
    • Localhost or remote server? AWS
  • Database
    • Localhost or remote server? Mlab

Logs/Trace

var/app/current/node_modules/parse-server/lib/ParseServer.js:218
          throw err;
          ^
MongoError: quota exceeded
    at Function.MongoError.create (/var/app/current/node_modules/agenda/node_modules/mongodb-core/lib/error.js:31:11)
    at toError (/var/app/current/node_modules/agenda/node_modules/mongodb/lib/utils.js:139:22)
    at /var/app/current/node_modules/agenda/node_modules/mongodb/lib/collection.js:748:67
    at /var/app/current/node_modules/agenda/node_modules/mongodb-core/lib/connection/pool.js:469:18
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! start_prod: `node --trace-warnings --max-old-space-size=2048 -r dotenv/config server.js`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the hinge-server@1.0.0 start_prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I have added below code to fix for now

process.on('uncaughtException', err => {
        if (typeof err === string) {
          process.stderr.write(`mongodb error ${err}.`);
        }
        if (err.code === 'EADDRINUSE') {
          // user-friendly message for this common error
          process.stderr.write(`Unable to listen on port ${err.port}. The port is already in use.`);
          process.exit(0);
        } else {
          throw err;
        }
      });

Just want to confirm is that, whatever is fixed is correct or should be handle in different way.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions