NextJs - mongoDB build fail - MongoDB connection error: Error: querySrv ETIMEOUT
Unanswered
Maine Coon posted this in #help-forum
Maine CoonOP
Hi all, i'm trying to deploy my nextjs app (using mongodb-atlas), it is building fine on local (npm run build), but when i deploy it on vercel, the build fails everytime with the following error :-
I've been looking for solution but could'nt find anything useful... I tried to restart WiFi (suggested by some SO answers), changed DNS to 8.8.8.8, switched network... Nothing worked.
Project info :-
.env :-
Also, in atlas network access, i have added 0.0.0.0, so it should be accessible from anywhere...
Can someone help?
MongoDB connection error: Error: querySrv ETIMEOUT _mongodb._tcp.mern.abcdefg.mongodb.net
⨯ Static worker exited with code: 1 and signal: null
MongoDB connection error: Error: querySrv ETIMEOUT _mongodb._tcp.mern.abcdefg.mongodb.net
MongoDB connection error: Error: querySrv ETIMEOUT _mongodb._tcp.mern.abcdefg.mongodb.net
MongoDB connection error: Error: querySrv ETIMEOUT _mongodb._tcp.mern.abcdefg.mongodb.net
> Build error occurred
Error: Jest worker encountered 4 child process exceptions, exceeding retry limit
at ChildProcessWorker.initialize (/vercel/path0/node_modules/next/dist/compiled/jest-worker/index.js:1:11580)
at ChildProcessWorker._onExit (/vercel/path0/node_modules/next/dist/compiled/jest-worker/index.js:1:12545)
at ChildProcess.emit (node:events:519:28)
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
type: 'WorkerError'
}
Error: Command "npm run build" exited with 1I've been looking for solution but could'nt find anything useful... I tried to restart WiFi (suggested by some SO answers), changed DNS to 8.8.8.8, switched network... Nothing worked.
Project info :-
next: 14.1.4,
react: ^18,
react-dom: ^18,
mongoose: ^8.3.5,.env :-
MONGO_URI=mongodb+srv://<username>:<password>@mern.abcdefg.mongodb.net/db_name?retryWrites=true&w=majority&appName=mernAlso, in atlas network access, i have added 0.0.0.0, so it should be accessible from anywhere...
Can someone help?