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
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?
Yes I can connect via MongoDB Compass
Is your database behind a VPC?
Is it publicly accessible?
Yes
I whitelist IP address to MongoDB Atlas so I can access via MongoDB Compass
Can you share your connection string format after removing the password field?
mongodb+srv://dh_bot_dev:<password>@mdb-dealhunter-001.dwvgk24.mongodb.net/mdb-dealhunter-001-dev?retryWrites=true&w=majority
Can you try adding
&ssl=true
to the connection string and check?Ok
Still same. 😦
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
Let me try again.
I tried both way, but all not working
Are you on the latest prisma version?