strapi mongo flutter app connection error

339 views Asked by At

When I install strapi via npm, then run "strapi new server" and then try to connect to mongodb atlas; It shows the following error.

(node:12564) 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.

⛔️ Connection test failed: failed to connect to server [oriapp-shard-00-01.pjvsw.mongodb.net:27017] on first connect [MongoNetworkError: connection 5 to oriapp-shard-00-01.pjvsw.mongodb.net:27017 closed at TLSSocket. (C:\Users\Sharm\AppData\Local\Temp\strapi236c8a243294\node_modules\strapi-connector-mongoose\node_modules\mongodb\lib\core\connection\connection.js:356:9) at Object.onceWrapper (events.js:422:26) at TLSSocket.emit (events.js:315:20) at TLSSocket.EventEmitter.emit (domain.js:483:12) at net.js:674:12 at TCP.done (_tls_wrap.js:567:7) { [Symbol(mongoErrorContextSymbol)]: {} }]

1

There are 1 answers

0
Gaurav Sharma On

So , the solution to the above problem:

  1. Reinstall strapi using npm or yarn or any other package manager.
  2. The ip whitelist in mongodb atlas in your cluster should have the ip address of your system.
  3. when aysnchronous function is defined use Ipv4 in place of "localhost:1337".

Thus one will be good to go.