complete-node-bootcamp
complete-node-bootcamp copied to clipboard
Error controller not working in production environment
When I try to get a error in production environment from my error controller file.instead of any error it keeps on sending in postman and don't give any response. Please help!!!!
Error controller is not working for me also. It is working fine with postman and getting JSON responses in postman when there is an error. But in browser, there is no JSON response for error. Only saying "Error: Request failed with status code 400" . Please help...
Error controller is not sending any response back in postman...
If your facing any errors with the Error handling in production/ development
-Check your mongoose version that it is exactly "mongoose": "^5.5.2" and not any version greater If its not then you should install it
Hey man! are you talking about this code below?
if(process.env.NODE_ENV === 'development') {
//Codes here
} else if (process.env.NODE_ENV === 'production') {
//Code here
}
Recently, I just encounter a problem where I can't receive any response in postman when I'm in production mode.
[SOLVED]
I just change one of the properties in the package.json file. by the way, I'm using Windows OS, If you are using MAC I guess you should remove the keyword 'SET'.
"start:prod": "SET NODE_ENV=production & nodemon ./server.js",
then add a one space after the word 'production'.
this is how it looks like.
else if (process.env.NODE_ENV === 'production ')
Maybe this solution doesn't work for you but that's how I solve my problem. Thanks for checking out.
Hey man! are you talking about this code below?
if(process.env.NODE_ENV === 'development') { //Codes here } else if (process.env.NODE_ENV === 'production') { //Code here }
Recently, I just encounter a problem where I can't receive any response in postman when I'm in production mode. [SOLVED] I just change one of the properties in the package.json file. by the way, I'm using Windows OS, If you are using MAC I guess you should remove the keyword 'SET'.
"start:prod": "SET NODE_ENV=production & nodemon ./server.js",
then add a one space after the word 'production'. this is how it looks like.else if (process.env.NODE_ENV === 'production ')
Maybe this solution doesn't work for you but that's how I solve my problem. Thanks for checking out.
Maybe this stack overflow post will help understand the concept : link
Hey man! are you talking about this code below?
if(process.env.NODE_ENV === 'development') { //Codes here } else if (process.env.NODE_ENV === 'production') { //Code here }
Recently, I just encounter a problem where I can't receive any response in postman when I'm in production mode. [SOLVED] I just change one of the properties in the package.json file. by the way, I'm using Windows OS, If you are using MAC I guess you should remove the keyword 'SET'.
"start:prod": "SET NODE_ENV=production & nodemon ./server.js",
then add a one space after the word 'production'. this is how it looks like.else if (process.env.NODE_ENV === 'production ')
Maybe this solution doesn't work for you but that's how I solve my problem. Thanks for checking out.Maybe this stack overflow post will help understand the concept : link
This worked for me, adding the space at the end, why does that error exist anyway, do you have any idea