MERN stack application deployment to Heroku issues - node.js

As the title says, when the application is supposed to be built and good, (at least during deployment, the log files etc always state that the build was successfull) when everything should be set to go, I open the site and encounter 2 console errors:
Failed to load resource: the server responded with a status of 503 (Service Unavailable)
Failed to load resource: the server responded with a status of 503 (Service Unavailable) favicon.ico:1
Tried looking up those errors and finding solutions but none of them seemed to work, Even though, the application works perfectly on local heroku (where you can test your app, in the heroku enviroment).
Not sure what I could do to fix my problem, as many forums suggest that you can't really do anything about it if it works fine on local heroku, it's must likely a server fault.
Thanks
edit: kinda fixed it myself after long days of struggling. Changed up file locations, moved server.js etc out from backend, into the main folder, and created a client folder, which now contains all the frontend stuff. Exact opposite what I used to have, since I used to have frontend out in the 'wild' and only had a backend folder for... well, backend files/folders/scripts.

Problem solved... kind of, still not sure why the first version i tried to use didn't work, but at the end of the day, I'm fine with it

Related

Failed to load resource: net::ERR_CONNECTION_REFUSED, Error after deploy

I developed a website using react and node.js, and my team deploy it on the server, the problem is when we try to use the website using the new domain or IP address it gives us this error:
Although it works fine in the localhost:3000 in the server, can you please give me the hints to solve this
I also faced the same issue because of not updating
backend URL so make sure to check the backend URL in the frontend. If you host any cloud-like Heroku then include on .env
In your case, there might be some other reason as well.

Socket.io.js can't be found (404)

I've developed a small chat application with Socket.io and Express, currently deployed on my droplet at digital ocean. You can see it live at https://keleheart.com/chatapp. It currently doesn't work because the server is giving back a 404 for the chatapp/socket.io/socket.io.js script I have at the bottom of my html file, should be able to see that when you visit the site and hit f12
I've been through a few fixes already that were popular on here such as This one and this one and I've even tried changing the script from local to a CDN as depicted here , and the CDN seems to work better,(still gives the 404 but it then no longer says io isn't defined??) but it still doesn't produce the output I need.
You are able to review my repo on my Github Page for this as well, there's just the index.html file for the client and then the chatApp.js for the server. The error is coming from my html file but all the fixes have told me to manipulate my package.json, server variables, and nothing has worked so far. My server still cannot find chatapp/socket.io/socket.io.js
Have you tried creating the /socket.io folder next to index.html, and putting a copy of socket.io.js inside of that? That has always worked for me, but you might have to hunt through the node_modules folder to get the file. This always fixed it for me.
And of course, be sure to actually serve the file using express's static method.
Your browser is giving you the correct error message. Since /socket.io/socket.io.js does not exist on the server, the browser displays the server's 404 message.

Deployed Angular 2 on Webserver throws status 0 on get

Thanks for the help, in advance.
I have developed a Angular 2 Single-Page Application and build it with ng build. I moved the builded stuff onto a webserver, on which a node.js backend is running on the port 4000. If you go to the main page, I try to get something from the backend with:
return this.http
.get("https://localhost:4000/auto")
.toPromise()
.then( (res)=> res.json());
But then I get this error message:
error message:
It does work if I change localhost to the ip Address of the webserver, but only if cross-origin is allowed in the backend, which I would like to have disabled.
A thing to note is, that I am also using https (ssl certificate) for the first time, so maybe there is something wrong ?
This is my first time deploying something to a real webserver, so I am not sure what is wrong. Everything else seems to work with the build, only got that problem, communicating with the backend on the same webserver (Webserver runs apache). I hope someone can help me. I hope i explained everything necessary, if you need more informations, tell me what you need.

Debugging ERR_CONNECTION_RESET error

Recently I started getting The connection was reset. error message (error code is ERR_CONNECTION_RESET) when I open one of my websites. This has nothing to do with application(node.js) level afaik as no changes or deploys were made in the application. To add to this, there were no error logs so I am assuming the request did not even receive the node app. The website is hosted on godaddy and its backend is a elastic beanstalk application. How do I fix this? On the web browser, in the second attempt it automatically loads correctly. But in a iframe which embeds my website, this has become a nasty issue as the browser does not even retry. I did the DNS analysis using dig command and all that but could not find anything relevant. Interesting part is this only happens after some interval (it does not happen continuously). On reload it works without fail.

IIS 404 Error even when file exists?

I have been working with IIS 7 for a while and it has worked fine until it just suddenly started throwing 404 errors for my multiple websites even though they actually exist. All of the configurations seems fine (path, default document) but not a single file, no matter the format or location will be loaded.
Another strange thing is that everything works when I try to access the websites via localhost or 127.0.0.1 but not through my external IP.
Does anyone know why this could happen and how I can fix it?
Edit:
It appears this 404 page is not the built in IIS error page. It is associated with nginx but I'm not sure where the file is located on my server or why my pages are being intercepted.
It turns at the server was hijacked by Morfeus F***ing Scanner, which I was not aware was even a thing until this happened. It's activity showed up in the server access logs. I basically had to reset the entire server. It was quite a chore.

Resources