Node.js app gives 504 on Plesk-Onyx - node.js

I have Node.js/Postgres app (tested and worked on different servers without an issue). When I try to run this app via Plesk's Node.js extension, the domain becomes inaccessible and I get 504 Gateway Time-out error.
Additionally, when I run the "start" script, Plesk panel output freezes and the only way to get an output is to run "killall node" command on SSH. After killing the node, I get the expected output without any errors.
All the dependencies are installed without any issue. Any idea what causes the problem and what is the solution?

Related

Nodejs Passport.local works fine on linux but not in docker container: 502 error

I have a Node application with passport-local authentication. In Visual Studio on Ubuntu, when I run the app it works fine, if login is successful it redirects to the homepage.
When I build a docker container from that app in ubuntu, pages that do not need login work fine, but pages that need login give the problem: when I log in with correct username and pw, instead of redirecting it gives a http 502 error, "currently unable to handle this request". I do not see any errors or logs.
The same app on MacOS, works from Visual studio AND works from a container that is build in the same way.
Hope someone can help, thanks!
Problem solved. Probably due to alpine container, if I build it wit bullseye-slim it works as it should be.
Strange because when built on mac with alpine, container runs fine, but when built and run on linux it gives 139 error.
So when using bullseye-slim it is ok. No more alpine... although I regret this.

Laravel running on Laradock – Getting Nginx Error 504 Gateway Time Out

The command that I executed was: docker-compose up -d nginx mysql, after reading the laradock docs
All is working correctly and the server runs smooth, but I have one problem that is driving me crazy. When I try to make a certain action on my website that needs a bit more of time, the browser gets stuck reloading and I get this error:

I have hosted my Nodejs Application on Amazon AWS. Now it shows 502 bad gateway after some time

I started the server using Command prompt by the command "sudo node server.js"
Then I closed the command prompt.
Now after some time, the website automatically shows 502 bad gateway error.
I had also used the command "sudo node server.js &" but it still not works.
Can you help me find out what could be the possible problem.
Thanks in advance!
The problem is that you app is not running, here is why.
When start the application in the command line, the application is handled by that bash instance. When you close that instance, so does the application.
The solution to this is to use a package like pm2 which will make sure that your application is always running.

Getting error in package.json while uploading to Openshift server

I am getting following error when i am trying to push my application to Openshift server. I have updated only package.json and trying to upload it on server then it showing this error.
So i have written couple of command to find out this error. So i found the following error but i am not getting what should i do now to fix this error.
My package.json is following below. If you think that there is some error in this package.json, please inform me. It is running fine on localhost but i do not know it is not able to find out package.json.
it's possible that the existing running application is not getting stopped correctly. Try using the rhc app stop command to completely stop your application, and then ssh to your gear (rhc ssh) and use the "ps -ef" command to make sure nothing else is running that would be taking up that port.

Getting 502 error in browser for a NodeJS app run with Forever

I have a SailsJS app set up on a Webfaction server. Everything works nicely (site can be accessed through browser, console works) when I run the app via any of the following commands, with and without the --prod param:
sails console,
sails lift,
node app.js
However, when I try to run the app with forever using forever app.js I get a 502 error, as if nodejs server isn't even running. When I run forever list I can see app.js listed among running processes.
How can I have my app run with forever?
Forever is considered outdated by many in the Node community, and thankfully, has been replaced by several other fantastic (dare I say, better) tools.
If you're running a newer flavor of Ubuntu, you can always install systemd and kick off the application that way. If you're seeking something more streamlined, Phusion Passenger might be your ticket. It has a long track record of successes, and I wouldn't hesitate to toss it into production.
I managed to solve this issue; the problem occurred due to SailsJS migration prompt which shows up when you start the server. Running app.js with forever worked, but the server didn't start because the script hanged waiting for a prompt reply. If you encounter this issue just make sure you have your migrate option set in model config to avoid running into migration prompt.

Resources