P
Prisma•2mo ago
Grinspire

Error: MongoDB error: An error occurred during DNS resolution: proto error: io error: A socket opera

https://github.com/prisma/prisma/discussions/14908 I found some solution online but this all doesn't work for me. Is there any other solution you can suggest? PrismaClientInitializationError: Invalid prisma.user.findMany() invocation: Error in connector: Error creating a database connection. (Kind: An error occurred during DNS resolution: proto error: io error: A socket operation was attempted to an unreachable network. (os error 10051), labels: {})
GitHub
Error: MongoDB error: `An error occurred during DNS resolution: pro...
Bug description Error: MongoDB error An error occurred during DNS resolution: proto error: io error: A socket operation was attempted to an unreachable network. (os error 10051) 0: migration_core::...
11 Replies
Nurul
Nurul•2mo ago
Hello @Grinspire 👋 Is your MongoDB database hosted on MongoDB Atlas? Are you able to connect to this database instance via a GUI tool like MongoDB Compass?
Grinspire
GrinspireOP•2mo ago
Yes I can connect via MongoDB Compass
Nurul
Nurul•2mo ago
Is your database behind a VPC? Is it publicly accessible?
Grinspire
GrinspireOP•2mo ago
Yes I whitelist IP address to MongoDB Atlas so I can access via MongoDB Compass
Nurul
Nurul•2mo ago
Can you share your connection string format after removing the password field?
Grinspire
GrinspireOP•2mo ago
mongodb+srv://dh_bot_dev:<password>@mdb-dealhunter-001.dwvgk24.mongodb.net/mdb-dealhunter-001-dev?retryWrites=true&w=majority
Nurul
Nurul•2mo ago
Can you try adding &ssl=true to the connection string and check?
Grinspire
GrinspireOP•2mo ago
Ok Still same. 😦
Nurul
Nurul•2mo ago
The error message indicates that somehow Prisma Client is not able to connect to your database. To ensure that this is not caused by whitelisting, can you temporarily whitelist all IPs, check if you are able to connect or not? If you are able to connect then we can be sure that this is due to some sort of IP restriction issue. If not, we can be sure that the issue is not related to IP restriction. After this you can again remove the rule of whitelisting all IPs
Grinspire
GrinspireOP•2mo ago
Let me try again. I tried both way, but all not working
Nurul
Nurul•2mo ago
Are you on the latest prisma version?

Did you find this page helpful?