question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongoError: getaddrinfo ENOTFOUND mongo mongo:27017

See original GitHub issue

Hi,

I’m trying run project during to README

/usr/src/app # npm run start

> jincor-backend-ico-dashboard@0.0.1 start /usr/src/app
> nodemon -w ./src -e ts ./src/bin/www --exec ts-node

[nodemon] 1.12.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /usr/src/app/src/**/*
[nodemon] starting `ts-node ./src/bin/www`
TypeORM connection error:  { MongoError: failed to connect to server [mongo:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo mongo:27017]
    at Pool.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/topologies/server.js:336:35)
    at emitOne (events.js:116:13)
    at Pool.emit (events.js:211:7)
    at Connection.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:280:12)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at Connection.emit (events.js:214:7)
    at Socket.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/connection.js:187:49)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
  name: 'MongoError',
  message: 'failed to connect to server [mongo:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo mongo:27017]' }

JWT was generated successfully, .env was copied from .env.test

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
silviocustodiocommented, Mar 17, 2021

I was with the same problem and I solved added useUnifiedTopology: true, in const options = { useNewUrlParser: true, useUnifiedTopology: true, }; I hope this helps someone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

mongodb - MongoError: getaddrinfo ENOTFOUND undefined ...
getaddrinfo ENOTFOUND means client was not able to connect to the given address. Please try with the above address. I hope this helps....
Read more >
Mongodb remote database connectivity error - getaddrinfo ...
Created a database in free MongoDB Atlas cloud in AWS, ... I am getting following error: getaddrinfo ENOTFOUND mycluster-u8ha7.mongodb.net.
Read more >
Got "getaddrinfo ENOTFOUND mongodb replica set." error ...
Hi , I'm a new on use Mongodb. When I deploy the mongodb operator on K8s from this github community,and I want to...
Read more >
[Solved]MUP Deploy : MongoError: failed to connect to server ...
[Solved]MUP Deploy : MongoError: failed to connect to server [mongodb:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongodb mongodb ...
Read more >
[COMPASS-4534] Unable to connect with v1.24.1 - Error
In v1.24.1, connections fail with a getaddrinfo ENOTFOUND mongodb ... MongoNetworkError: failed to connect to server [mongodb:27017] on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found