We have several nodejs daemons that use mongoose when sharing the same level of stability (a common module containing requests).
In one of these demons (always the same one), we randomly (several times a week) receive the following error from the mongoose:
mongoose: invalid argument findOne ()
We checked all the requests and were unable to find out where this might come from. The error call stack is different each time ( no specific mongoose call seems to cause this problem ), so we donβt think this is specific to business logic.
To do some debugging, we added the following logging in case the error repeats:
log({ // What mongoose checks (both false -> the error). isInstanceOfMQuery: conds instanceof mquery, isObject: mquery.utils.isObject(conds), // Trying to find out what this value is. conds, toString: Object.prototype.toString.call(conds) inspect: util.inspect(conds, { showHidden: true, depth: null, showProxy: true }) })
conds is the argument mongoose complains about. log () will be JSON.stringify () all this.
This is one of the logs resulting from this call:
{ "isInstanceOfMQuery": false, "isObject": false, "conds": {}, "toString": "[object Null]" "inspect": "{}", }
Now it bothers me even more ... how can conds be {} and null at the same time ?!
The answers I'm looking for:
- How can I reproduce such an object that contains conds?
- How can you fix a mistake that seems to happen by chance and rarely?
- Is it possible that we can log in to determine what the meaning of conds is or where it occurs?
Any ideas appreciated!
patrickd
source share