MongoDB and Vercel connection issues

Hi! I have been facing a lot of issues with MongoDB integration with Vercel. I have done EVERYTHING recommended online:

  • Added Allow from Anywhere access to my MongoDB Cluster
  • Degraded mongoose to lower version
    But Im still getting this error when I send GET requests to my APIs that talk with the MongoDB cluster.

And before you say this is a MongoDB issue it is not. Because sometimes the REQUESTS work from your end, and then sometimes they fail with the following error:

Unhandled Rejection: 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://www.mongodb.com/docs/atlas/security-whitelist/
    at _handleConnectionErrors (/var/task/node_modules/mongoose/lib/connection.js:829:11)

Hi, @tas2017!

Unsure if this is helpful, but given the error message I wonder if it’s related to this from another thread:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.