Skip to content

[Bug]: Cannot find package "mongodb-extjson" #256

@nixrajput

Description

@nixrajput

🔎 Search Terms

mongodb-winston,typescript

The problem

"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1",
"winston-mongodb": "^5.1.1"

Getting below error when using with TypeScript:

Cannot find package "mongodb-extjson" from "/home/user/Workspace/nodejs-projects/express-api/node_modules/winston-mongodb/node_modules/mongodb/lib/core/utils.js"

What version of Winston presents the issue?

v3.11.0

What version of Node are you using?

v20.x

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

import {
  MongoDBTransportInstance,
  MongoDBConnectionOptions,
} from "winston-mongodb";
import { createLogger, format, transports } from "winston";

const {
  MongoDB,
}: { MongoDB: MongoDBTransportInstance } = require("winston-mongodb");

const mongoTransport = new MongoDB({
  db: LocalConfig.getConfig().MONGO_URI!,
  dbName: LocalConfig.getConfig().DB_NAME!,
  storeHost: true,
  collection: "logs",
  options: {
    useNewUrlParser: true,
    useCreateIndex: true,
    useUnifiedTopology: true,
  },
  format: format.combine(
    format.timestamp(),
    format.json()
    // errorStackFormat(),
    // format.printf(({ timestamp, level, message }) => {
    //   return `[${timestamp}] ${level}: ${message}`;
    // })
  ),
} as MongoDBConnectionOptions);

Additional information

No response

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