I'm trying to connect to a Mongo Database Atlas but I'm getting a DNS error, on node.js it works just fine.
( it was working before i updated )
Output:
❯ bun run dev
$ bun --watch ./bot/src/bot.ts
[0.02ms] ".env"
Logging into discord...
Logged In
Connecting to database ...
mongodb+srv://***:***/?retryWrites=true&w=majority
error: srv lookup failed: Timeout while contacting DNS servers
code: "DNS_ETIMEOUT"
Code:
import { Client } from "discord.js";
import mongoose from "mongoose";
import { IEventHandler } from "../handlers/eventHandler";
import BotSettingsModel from "../models/botSettings"; // Import your Mongoose model
export default {
name: 'ready',
once: true,
async execute(client: Client) {
console.log('Connecting to database ...');
console.log(process.env.MONGO_URI)
await mongoose.connect(process.env.MONGO_URI || '', { maxPoolSize: 20 })
console.log("Connected to the database!");
console.log(`Ready! Logged in as ${client.user?.tag}`);
client.user?.setActivity(`PSO Brasil | League | Bot desenvolvido por @sueroo`);
}
} as IEventHandler;
I'm trying to connect to a Mongo Database Atlas but I'm getting a DNS error, on node.js it works just fine. ( it was working before i updated )
Output:
Code:
Originally reported on Discord:
DNS Errors when trying to connect to a MongoDB URI