Skip to content

TypeError: value.getLowBits is not a function #203

@erodriguezds

Description

@erodriguezds

Ocasionally, I get this error from the logger, which crashes my app:

TypeError: value.getLowBits is not a function
    at serializeLong (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:388:23)
    at serializeInto (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:956:17)
    at serializeObject (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:347:18)
    at serializeInto (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:941:17)
    at serializeObject (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:347:18)
    at serializeInto (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:941:17)
    at serializeObject (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:347:18)
    at serializeInto (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:941:17)
    at serializeObject (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:347:18)
    at serializeInto (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:941:17)
    at serializeObject (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:347:18)
    at serializeInto (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:727:17)
    at serializeObject (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:347:18)
    at serializeInto (/usr/src/app/node_modules/bson/lib/bson/parser/serializer.js:941:17)
    at BSON.serialize (/usr/src/app/node_modules/bson/lib/bson/bson.js:64:28)
    at Msg.serializeBson (/usr/src/app/node_modules/mongodb/lib/core/connection/msg.js:126:22)
Emitted 'error' event on DerivedLogger instance at:
    at DerivedLogger.transportEvent (/usr/src/app/node_modules/winston/lib/winston/logger.js:630:12)
    at exports.MongoDB.emit (node:events:539:35)
    at /usr/src/app/node_modules/winston-mongodb/lib/winston-mongodb.js:230:12
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

We log thousand of records every minute... and I can't still find the message that triggers this error.

It would be nice to, at least, catch this error, and not crash the entire application... or maybe to have an option to control what to do whenever this type of errors occurs (maybe an "onUnhandledError" option?).

I think that, as this is simply a logging library/transport-driver, It cannot interfere, in any way, with the app's main flow, so, any error with the underlying MongoDB connection, should be handled properly... or at least: catched.

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