Skip to content

MongoNetworkError: failed to connect to server #5

@monolithed

Description

@monolithed
➜ cd ./gateway && npm install && npm run test

> gateway@0.0.1 test
> jest --config ./test/jest-e2e.json --detectOpenHandles

(node:32062) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-deprecation ...` to show where the warning was created)
 FAIL  test/task.e2e-spec.ts
  ● Tasks (e2e) › /users/ (POST) - should create a user for checking tasks api

    MongoNetworkError: failed to connect to server [db:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND db

      at connectionFailureError (../node_modules/mongodb/lib/core/connection/connect.js:340:14)
      at Socket.<anonymous> (../node_modules/mongodb/lib/core/connection/connect.js:310:16)
        errno: -3008,
        code: 'ENOTFOUND',
        syscall: 'getaddrinfo',
        hostname: 'db'
      }]
      at Pool.<anonymous> (../node_modules/mongodb/lib/core/topologies/server.js:438:11)
      at ../node_modules/mongodb/lib/core/connection/pool.js:562:14
      at ../node_modules/mongodb/lib/core/connection/pool.js:995:11
      at ../node_modules/mongodb/lib/core/connection/connect.js:32:7
      at callback (../node_modules/mongodb/lib/core/connection/connect.js:280:5)
      at Socket.<anonymous> (../node_modules/mongodb/lib/core/connection/connect.js:310:7)
➜ ls ./node_modules/mongodb/lib/core/connection/connect.js
./node_modules/mongodb/lib/core/connection/connect.js
➜ docker images
REPOSITORY                                TAG       IMAGE ID       CREATED       SIZE
nestjs-microservices-example_task         latest    8f6ea10c6c9c   2 hours ago   301MB
nestjs-microservices-example_token        latest    d91cd08050e6   2 hours ago   304MB
nestjs-microservices-example_user         latest    4ea9ae968a07   2 hours ago   305MB
nestjs-microservices-example_permission   latest    45fc5c5b4651   2 hours ago   287MB
nestjs-microservices-example_mailer       latest    bc43a7509bca   2 hours ago   312MB
nestjs-microservices-example_gateway      latest    be198aa8b10e   2 hours ago   376MB
mongo                                     3.7       3db1239d511b   3 years ago   365MB
➜ docker network ls
NETWORK ID     NAME                                   DRIVER    SCOPE
c1f91c7540aa   bridge                                 bridge    local
cd35c2d8606f   host                                   host      local
e202db18ab24   infrastructure                         bridge    local
bb8f103e8d56   nestjs-microservices-example_backend   bridge    local
ae658c26cd1e   none                                   null      local
➜ ls -l
total 1224
-rw-r--r--    1 monolithed  staff     188 26 июл 10:06 Dockerfile
-rw-r--r--    1 monolithed  staff      84 26 июл 10:06 nest-cli.json
drwxr-xr-x  524 monolithed  staff   16768 26 июл 11:35 node_modules
-rw-r--r--    1 monolithed  staff  598555 26 июл 11:35 package-lock.json
-rw-r--r--    1 monolithed  staff    1555 26 июл 11:35 package.json
drwxr-xr-x    9 monolithed  staff     288 26 июл 10:06 src
drwxr-xr-x   11 monolithed  staff     352 26 июл 10:06 test
-rw-r--r--    1 monolithed  staff      97 26 июл 10:06 tsconfig.build.json
-rw-r--r--    1 monolithed  staff     362 26 июл 10:06 tsconfig.json
-rw-r--r--    1 monolithed  staff     503 26 июл 10:06 tslint.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions