Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Why can Heroku Connect To MongoDB Atlas But Not My Local Environment

When connecting to my MongoDB Atlas server from a node.js server, the following code works completely fine on Heroku:

mongoose.connect(process.env.dbLink, {
    useNewUrlParser: true,
    useUnifiedTopology: true
})
const db = mongoose.connection
db.once("open", () => {
    console.log("Database connected")
})

However, when I run this on my computer, I get the following error:

const serverSelectionError = new ServerSelectionError();

MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/

However, my IP address is whitelisted.

How can I make this work on my local environment?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!