How do I solve Configuration property "jwt" and "DB" is not defined error

I am trying to push my web application (MERN stack) to Heroku but I keep getting this error

What I have tried in index.js


if (!config.get("jwtPrivateKey")) {
throw new Error('FATAL ERROR!!: jwtPrivateKey is not defined')
}

console.log(config.get("DB"))
console.log(config.get("jwtPrivateKey"))

When I log their values they are all listed

at the config folder there are two files default.json and custom-environment-variables.json default.json

{
"jwtPrivateKey" : "",
"requiresAuth": false,
"DB":"mongodb+srv://****/test"
}

custom-environment-variables.json

{
"jwtPrivateKey" : "RhinoJohn_jwtPrivateKey",
"DB": "Rhinojohn_DB"
}

When i run heroku config on the CLI i get all their values

I have checked this question but none of the answers solves my problem. How do i solve Configuration property “jwtPrivateKey” is not defined?? I’m out of options

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.