Skip to content

NodeJS 20 Deprecation Warning DEP0170 #218

@samuelexferri

Description

@samuelexferri

I'm using NodeJS 20 and this Winston MongoDB config:

const logger: CustomLevels = winston.createLogger({
    ...winstonLoggerOptions,
    transports: [
        new MongoDB({
            level: "info",
            db: dbURL,
            options: {
                serverSelectionTimeoutMS: 2147483647, // Never stop trying to reconnect
                useNewUrlParser: true,
                useUnifiedTopology: true,
            },
            collection: "logs",
            storeHost: true,
            capped: false, // Alternative to expireAfterSeconds
            tryReconnect: true,
            decolorize: true,
            expireAfterSeconds: 60 * 60 * 24 * 120, // 120 days
        }),
        new winston.transports.Console({
            level: "debug",
        }),
    ],
});

I get this warning when running:
(node:40350) [DEP0170] DeprecationWarning: The URL mongodb://project-staging:[email protected]:27017,sp-cluster0-shard-00-00.t3lku.gcp.mongodb.net:27017,sp-cluster0-shard-00-01.t3lku.gcp.mongodb.net:27017/project-staging?authSource=admin&replicaSet=sp-cluster0-shard-0&ssl=true is invalid. Future versions of Node.js will throw an error.

Earlier versions of NodeJS (<19) don't throw any warnings.

Metadata

Metadata

Assignees

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