Got this error a couple days ago after doing a routine update to a .env variable on Render. The branch would always deploy with no issues even just a month ago, but started prompting this error recently. Local deploy works. Nothing in the codebase has changed except the .env on Render. Also, for some reason the branch would successfully deploy when doing a rollback to a previous deployment of that same branch… dotenv IS in my dependencies in package.json and dotenv IS being called properly from my server.js from what I understand. Am I overlooking something?
Some things I’ve tried:
- Different Node versions using NODE_VERSION in .env
- Deleted node_modules and did new npm install
- Revert .env back to previous setup
server.js (dotenv)
import path from ‘path’;
import express from ‘express’;
import dotenv from ‘dotenv’;
import cors from ‘cors’;
import nodemailer from ‘nodemailer’;
import cookieParser from ‘cookie-parser’;
dotenv.config();
package.json
{
“name”: “frame_coffee”,
“version”: “1.0.0”,
“description”: “FRAME coffee roasters main website/ ecommerce store built using MERN stack”,
“type”: “module”,
“main”: “server.js”,
“scripts”: {
“postinstall”: “npm install dotenv”,
“start”: “node backend/server.js”,
“server”: “nodemon backend/server.js”,
“client”: “npm start --prefix frontend”,
“dev”: "concurrently "npm run server" "npm run client" ",
“data:import”: “node backend/seeder.js”,
“data:destroy”: “node backend/seeder.js -d”,
“build”: “npm install && npm install --prefix frontend && npm run build --prefix frontend”
},
“repository”: {
“type”: “git”,
“url”: “git+https://github.com/yshin22/framecoffee.git”
},
“author”: “”,
“license”: “MIT”,
“bugs”: {
“url”: “Issues · yshin22/framecoffee · GitHub”
},
“homepage”: “GitHub - yshin22/framecoffee”,
“dependencies”: {
“bcryptjs”: “^2.4.3”,
“colors”: “^1.4.0”,
“cookie-parser”: “^1.4.6”,
“cors”: “^2.8.5”,
“express”: “^4.18.2”,
“jsonwebtoken”: “^9.0.2”,
“mongoose”: “^7.5.2”,
“multer”: “^1.4.5-lts.1”,
“nodemailer”: “^6.9.7”,
“shippo”: “^1.7.1”
},
“devDependencies”: {
“concurrently”: “^8.2.1”,
“dotenv”: “^16.4.5”,
“nodemon”: “^3.0.1”
}
}