Code-the-Dream-School / gg-pac-team5-back

Back End Repo for Giraffe / Grackle Practicum Team 5
2 stars 0 forks source link

The backend server currently crashes when .env is not found #5

Open CHEUNG-K-Jeffrey opened 1 month ago

CHEUNG-K-Jeffrey commented 1 month ago

Crashes with 2ec81ba5868a326182ce865fbf42f7797d0cba9b

% npm run dev

> bb-practicum-team-1-back@1.0.0 dev
> nodemon src/server.js

[nodemon] 2.0.21
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node src/server.js`
Connected to the DB
(node:30351) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
    at _createMongoClient (/Users/jeffreycheung/Source Code/Mighty Heap Practicum Project/gg-pac-team5-back/node_modules/mongoose/lib/connection.js:768:11)
    at NativeConnection.openUri (/Users/jeffreycheung/Source Code/Mighty Heap Practicum Project/gg-pac-team5-back/node_modules/mongoose/lib/connection.js:705:29)
    at Mongoose.connect (/Users/jeffreycheung/Source Code/Mighty Heap Practicum Project/gg-pac-team5-back/node_modules/mongoose/lib/index.js:406:15)
    at connectDB (/Users/jeffreycheung/Source Code/Mighty Heap Practicum Project/gg-pac-team5-back/src/db/connect.js:5:19)
    at /Users/jeffreycheung/Source Code/Mighty Heap Practicum Project/gg-pac-team5-back/src/server.js:7:11
    at Object.<anonymous> (/Users/jeffreycheung/Source Code/Mighty Heap Practicum Project/gg-pac-team5-back/src/server.js:13:3)
    at Module._compile (node:internal/modules/cjs/loader:1467:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1551:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
[nodemon] clean exit - waiting for changes before restart
SergeDot commented 1 month ago

I am checking with Chase how to deal with that to make the code shareable