complete-node-bootcamp icon indicating copy to clipboard operation
complete-node-bootcamp copied to clipboard

Error controller not working in production environment

Open samm106 opened this issue 4 years ago • 6 comments

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!!!!

samm106 avatar May 14 '20 07:05 samm106

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...

merndev avatar May 21 '20 15:05 merndev

Error controller is not sending any response back in postman...

iamveekthorr avatar Jun 27 '20 20:06 iamveekthorr

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

ChristyShafack avatar Aug 24 '20 23:08 ChristyShafack

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.

saysonjerald avatar Nov 16 '20 12:11 saysonjerald

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

singhAmandeep007 avatar Nov 18 '20 13:11 singhAmandeep007

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

Felixmurithi avatar Jan 13 '24 15:01 Felixmurithi