1

I have trouble getting my web service up and running. I developed a full stack MERN application and have my client folder already successfully deployed. However, when I try to deploy my backend folder wolf-watch-server I am running into the following issue (it looks like it can not find the mongoURI, even though I have set the environment variables on render.com):

Jan 22 07:31:38 PM  WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
Jan 22 07:31:38 PM  WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Jan 22 07:31:38 PM  WARNING: No configurations found in configuration directory:/opt/render/project/src/config
Jan 22 07:31:38 PM  WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
Jan 22 07:31:39 PM  /opt/render/project/src/node_modules/config/lib/config.js:182
Jan 22 07:31:39 PM      throw new Error('Configuration property "' + property + '" is not defined');
Jan 22 07:31:39 PM      ^
Jan 22 07:31:39 PM  
Jan 22 07:31:39 PM  Error: Configuration property "mongoURI" is not defined

My environment variables are mongoURI and jwtSecret on render.com. I have pushed my server folder to github and included the following in my .gitignore file:

/node_modules
/build
/npm-debug.log
/.nyc
/.env
/.DS_Store
/config

My folder structure looks like the following:

> wolf-watch-server (contains all the files of the backend/server)
  > config 
      dafault.json (contains json object -> "mongoURI":"mongodb+srv://<username>:<password>@cluster0.wouim.mongodb.net/?retryWrites=true&w=majority", "jwtSecret":"fsaff" )
  > routes
  .gitignore
  index.js
  package-lock.json
  package.json

My package.json

{
  "name": "wolf-watch-server",
  "version": "1.0.0",
  "description": "wolf watch website",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js",
    "server": "nodemon index.js",
    "client": "cd ../wolf-watch && npm start",
    "dev": "concurrently \"npm run server\" \"npm run client\""
  },
  "author": "Josua Hall",
  "license": "ISC",
  "devDependencies": {
    "nodemon": "^2.0.13"
  },
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "concurrently": "^6.2.1",
    "config": "^3.3.6",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "express-session": "^1.17.2",
    "express-validator": "^6.14.0",
    "joi": "^17.5.0",
    "joi-browser": "^13.4.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^6.0.7",
    "multer": "^1.4.4"
  }
}
Josua
  • 27
  • 3
  • if I delete the /config in the .gitignore it works just fine, however, I have my mongoURI on my github, which I do not want. How can I upload the mongoURI without showing it on github – Josua Jan 23 '23 at 02:09

0 Answers0