Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CHEUNG-K-Jeffrey opened this issue Aug 1, 2024 · 1 comment
Open
Assignees

Comments

@CHEUNG-K-Jeffrey
Copy link
Collaborator

CHEUNG-K-Jeffrey commented Aug 1, 2024

Crashes with 2ec81ba

% npm run dev

> [email protected] 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
@CHEUNG-K-Jeffrey CHEUNG-K-Jeffrey changed the title The server currently crashes due to a MongooseError when run The backend server currently crashes due to a MongooseError when run Aug 1, 2024
@CHEUNG-K-Jeffrey CHEUNG-K-Jeffrey changed the title The backend server currently crashes due to a MongooseError when run The backend server currently crashes when .env is not found Aug 1, 2024
@SergeDot
Copy link
Collaborator

SergeDot commented Aug 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants