Dear Vercel Support,
We are encountering a persistent DNS resolution failure (querySrv ENOTFOUND) in our Vercel serverless function when attempting to connect to a MongoDB Atlas database using the mongodb+srv:// protocol. The issue occurs consistently despite our best troubleshooting efforts and appears to be specific to the Vercel serverless function environment.
Here are the key details:
-
Connection String: mongodb+srv://iman:XMB8jSv6WJ7oD0oj@cluster0.y1tlq.mongodb.net/TaldUnia?retryWrites=true&w=majority&appName=Cluster0
-
Error: querySrv ENOTFOUND _mongodb._tcp.cluster0.y1tlq.mongodb.net
-
Vercel Project: Deployed in the iad1 region
-
Environment Variable: The MONGODB_URI environment variable is correctly set and available to our serverless function.
-
Code: Our connection logic includes a retry mechanism to handle intermittent DNS issues, but the error occurs even after multiple retries, indicating it is a persistent problem.
-
MongoDB Atlas Configuration: Network access is set to allow all IPs (0.0.0.0/0) for troubleshooting, and no custom VPC peering or private endpoints are configured.
-
SRV Record Resolution: Our MongoDB Atlas SRV records can be resolved locally using dig or nslookup , ruling out issues with the DNS records themselves.
Based on this, the application is trying to connect from a Vercel serverless function, and there are no errors in our codebase or within our Mongo configuration that we are aware of. We are suspecting there is some network related issue between Vercel’s serverless function environment and an ability to properly resolve the DNS entries for our MongoDB Atlas cluster.
Could you please investigate potential network or DNS resolution issues specific to your serverless function environment in the iad1 region that might be preventing our application from resolving the MongoDB Atlas hostname? Is there anything we need to configure on our end to allow the serverless function to resolve external SRV records