Node server started but crashed after few seconds

sri@sri-To-be-filled-by-O-E-M:~/mongodb/mflix/mflix-js$ sudo npm start

server@1.0.0 start /home/sri/mongodb/mflix/mflix-js
nodemon -L ./index.js

[nodemon] 1.19.1
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node ./index.js
MongoParseError: URI malformed, cannot be parsed
at parseConnectionString (/home/sri/mongodb/mflix/mflix-js/node_modules/mongodb/lib/core/uri_parser.js:502:21)
at connect (/home/sri/mongodb/mflix/mflix-js/node_modules/mongodb/lib/operations/connect.js:266:3)
at ConnectOperation.execute (/home/sri/mongodb/mflix/mflix-js/node_modules/mongodb/lib/operations/connect.js:191:5)
at /home/sri/mongodb/mflix/mflix-js/node_modules/mongodb/lib/operations/execute_operation.js:109:26
at new Promise ()
at executeOperation (/home/sri/mongodb/mflix/mflix-js/node_modules/mongodb/lib/operations/execute_operation.js:102:10)
at MongoClient.connect (/home/sri/mongodb/mflix/mflix-js/node_modules/mongodb/lib/mongo_client.js:216:10)
at Function.MongoClient.connect (/home/sri/mongodb/mflix/mflix-js/node_modules/mongodb/lib/mongo_client.js:379:22)
at Object.connect (/home/sri/mongodb/mflix/mflix-js/src/index.js:23:13)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
[nodemon] app crashed - waiting for file changes before starting…

1 Like

Please check the URI string in .env file. Also, make sure the firewall is disabled to allow connections to the cluster.