Skip to content

MongoDB SRV connection fails in Node v24.13.0 (works in v24.11.1) Version: #61448

@udayshankar754

Description

@udayshankar754

Version

v24.13.0

Platform

Windows 11 x64  
Windows Server x64

Subsystem

No response

What steps will reproduce the bug?

  1. Install Node.js v24.13.0
  2. Run the following code:
    const express = require("express");
    const mongoose = require("mongoose")

const app = express();

const connectDB = async () => {
try {
const conn = await mongoose.connect("mongodb+srv://:@cluster0.u0yrsfk.mongodb.net/db_name");
console.log(MongoDB Connected: ${conn.connection.host});
} catch (error) {
console.error('MongoDB connection failed:', error.message);
process.exit(1);
}
};
connectDB();

app.listen(3300, () => {
console.log("mongodb connected at port 3300")
})

How often does it reproduce? Is there a required condition?

Reproduces 100% of the time with Node v24.13.0 on Windows (11 and Server).
Works correctly on Node v24.11.1.
No special conditions beyond a MongoDB SRV connection URI.

What is the expected behavior? Why is that the expected behavior?

The connection should succeed, as it does in Node v24.11.1.
This is expected because Node.js v24.13.0 should maintain compatibility with network/DNS operations that were functional in v24.11.1.

What do you see instead?

node:internal/dns/promises:294
this.reject(new DNSException(err, this.bindingName, this.hostname));
^

Error: querySrv ECONNREFUSED _mongodb._tcp.cluster0.u0yrsfk.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:294:17) {
errno: undefined,
code: 'ECONNREFUSED',
syscall: 'querySrv',
hostname: '_mongodb._tcp.cluster0.u0yrsfk.mongodb.net'
}

Node.js v24.13.0

Additional information

Image

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