Could not proxy request from localhost:3000 to localhost:7000 ReactJs - javascript

I provided an api to my react app, it was working fine, but suddenly it stopped working.
in my client (React app) package.json
"proxy": "http://localhost:7000"
now it tell me this error message:
Could not proxy request /api/users/signup from localhost:3000 to http://localhost:7000.
thanks in advance.

Maybe you created a socket and didn't free the port afterwards ? This may happen if your app crashes. When you launch it again, the port may be occupied and unavailable, it happened to me a few times.

Related

Deploying github repo to railway. app resulting - Application Error Is your app correctly listening on PORT?

There was a solution available on github of adding the variable i did that, what ever i put port number it says already in use, follow is the error on deploy log..
listening on port 9586
Port 9586 is already in use
[nodemon] app crashed - waiting for file changes before starting...
Following is the error when i open the deployed link
Application Error
Is your app correctly listening on $PORT?
View the deployment below to check for errors
this is the link of deployed repo https://rehub-backend.up.railway.app/ ,
Please do assist if u have any idea
In place of
app.listen(PORT);
use
app.listen(process.env.PORT);

Javascript app (with webpack ) not opening on heroku , " App boot timeout"

I'm currently trying to get my javascript+webpack app to deploy on Heroku.
Github link of the app here.
It works fine locally, but I can't manage to deploy it on Heroku. I get an error message like: App boot timeout. See screenshot below:
Screenshot 1:
Screenshot 2:
Does anyone have an idea of how I can fix this?
ps: I tried Netlify, managed to have the app displayed but API calls didn't work because my API URL starting with http instead of https, but no way around that the API selected for this project doesn't on https :-( so that's why I'm trying to get this one to work on Heroku.
This is happening because your express code is binding to port 8081, while heroku likes to pass in it's own port when deploying express apps. That's why your error message is saying Web process failed to bind to $PORT within 60 seconds of launch. To fix this you need to pass in your port as a variable and bind to it.
server.js
const app = require("./index.js");
app.set('port', process.env.PORT || 8081);
app.listen(app.get('port'), function () {
console.log(`running on localhost: `, server.address().port);
});
Minimal code example here.

Network error. The request timed out in react app

my react app was working fine on localhost but
after build react app and upload it on my server it doesnt work and this is what i get
I think it doesnt connect to graphql and mongodb
and this is my dependencies
what should I do?
edit:
i changed URIs in code to my host and I dont know where's my problem
in localhost I start server every time with npm run dev is there any chance that i have start app in server too?

WebSockets working on localhost, but do not work on remote Ubuntu host

I have two applications - browser based client and NodeJS based server that are both communicating using WebSockets (I'm using ColyseusJS library). Problem is, that everything works fine while I'm testing them on localhost but when I deploy the application to my Ubuntu VPS server it stops working.
The message I receive in the browser while trying to connect is:
WebSocket connection to 'ws://X.X.X.X:8001/?colyseusid=' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
So it reaches the server (because when server is disabled the message is "Error in connection establishment: net::ERR_CONNECTION_REFUSED") but it looks like it fails on Upgrade connection operation.
What is strange is that I managed to make it work yesterday (don't know how exactly), but had so much mess on my VPS that I decided to revert machine to it's starting state. After that it stopped working (code is unchanged). Maybe there are some additional dependencies that I need to install in order to make it work on my Ubuntu Server?
I would really appreciate your help.
Have you tried to port forward the port to the ip address of the said VPS in your router config? And also check out the firewalls.

Sails.js server not starting anymore

I am using Cloud 9 IDE to develop a simple CRUD application using Sails.js (node.js MVC framework). Up until today I had no trouble starting the Sails.js server.
Today, I've been trying to start the sails js server, but I keep getting this error:
warn: error raised: Error: listen EACCES
error: Server doesn't seem to be starting.
error: Perhaps something else is already running on port 8080?
I have checked my /config/local.js file and everything is just fine, as it should be. The port is set to process.env.PORT || 1337 so it shouldn't have any problems firing the server up.
I'm looking forward to your insight.
Thank you!
Open terminal and run this command:
$ lsof -i :8080
Output will show PID of process occupying port 8080: "httpd 1234 ....'
Then kill the process with this command
$ kill -9 1234
Sails will now run
Hmm-- looks like port 8080 isn't available. What happens if you try to switch the port? You may have another server running on that port. Or in some cases, hosts require the hostname to be set. I'd try switching the port first though.
The only real answer to this is: wait. C9 seems to kill servers in a weird way that causes Sails to jack up and blocks you from establishing another server. lsof -i doesn't show anything serving... but it still won't start. Seems to be an issue with Cloud 9 and Sails.js. If I serve a generic Node.js "Hello World" app on the same port, the issue doesn't occur. However, time, it seems, cures all. After awhile, Sails seems to snap out of it and starts serving again when lifted.
Incredibly weird.

Categories

Resources