MongooseServerSelectionError: connect ECONNREFUSED <not 127.0.0.1>
See original GitHub issuePrerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Mongoose version
6.7.2
Node.js version
18.12.1
MongoDB server version
5.0.13
Typescript version (if applicable)
No response
Description
I bought a mongodb server from my host and I have this error: MongooseServerSelectionError: connect ECONNREFUSED <the ip of the db with the port>
Steps to Reproduce
My uri to connect the db is: mongodb://admin:<the password>@<the ip of the db>:26041/Guilds?retryWrites=true&w=majority
I connect the db like that: await mongoose.connect(config.MONGODB_GUILDS_URI)
.
And if I connect with a mongodb db not a db of my host it work. and this is all of the error:
MongoServerError: Authentication failed.
at Connection.onMessage (C:\Users\yassi.ABKAHOME\Documents\Bots-Discord\Bots-Test\UtilityBotTest\node_modules\mongodb\lib\cmap\connection.js:207:30)
at MessageStream.<anonymous> (C:\Users\yassi.ABKAHOME\Documents\Bots-Discord\Bots-Test\UtilityBotTest\node_modules\mongodb\lib\cmap\connection.js:60:60)
at MessageStream.emit (node:events:513:28)
at processIncomingData (C:\Users\yassi.ABKAHOME\Documents\Bots-Discord\Bots-Test\UtilityBotTest\node_modules\mongodb\lib\cmap\message_stream.js:132:20)
at MessageStream._write (C:\Users\yassi.ABKAHOME\Documents\Bots-Discord\Bots-Test\UtilityBotTest\node_modules\mongodb\lib\cmap\message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at Socket.ondata (node:internal/streams/readable:766:22)
at Socket.emit (node:events:513:28) {
ok: 0,
code: 18,
codeName: 'AuthenticationFailed',
connectionGeneration: 0,
[Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }
}
I already change the password or other but nothing.
Expected Behavior
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:6
Top Results From Across the Web
connect ECONNREFUSED 127.0.0.1:27017 - Ops and Admin
MongooseServerSelectionError : connect ECONNREFUSED 127.0.0.1:27017 ... but when connecting using shell or Compass there is no problem,.
Read more >MongoError: connect ECONNREFUSED 127.0.0.1:27017
I had below error: Error: connect ECONNREFUSED 127.0.0.1:27017. In my case, this issue occurred since MongoDB is not installed at all.
Read more >[Question] Connect fail MongooseServerSelectionError ...
But on the server, it keeps saying connect ECONNREFUSED 127.0.0.1:27017, I have researched for more than 4 hours but still no results.
Read more >mongodb connect econnrefused 127.0.0.1 - You.com | The AI ...
This happened probably because the MongoDB service isn't started. Follow the below steps to start it: Go to Control Panel and click on...
Read more >ECONNREFUSED 127.0.0.1:27017 | Resolve the connection ...
This video will demonstrate a way how you can resolve the error " connect ECONNREFUSED 127.0.0.1 :27017". So this is a connection issue...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@andreWPatskan3 Sounds like https://github.com/nodejs/node/issues/40537
I got same problem using node 18, i rolled back to 16 and everything works properly