Connect to services using Private Networks
Project ID: 1790d4a8-0e32-4b4e-bf67-6ce23d7ae9e1
I'm trying to connect my main project (Node.js) to a Python API hosted in the same Railway project, according to the logs, my Python project is listening to
http://0.0.0.0:3001
and is online on inswapper.railway.internal
.
I'm not really sure how to connect to the Python API from the main project and most probably misunderstanding how private networking works, so far I tried to make an Axios post request to the endpoint but that returns an ECONNREFUSED
error:
I also attempted to make a request to http://inswapper.railway.internal:3001/swapper
but that resulted in an error as well.
This is the code that I use to make requests to the Python API:
(I've set process.env.INSWAPPER
to both 0.0.0.0:3001
and inswapper.railway.internal:3001
, none worked)
Also, my Python API takes around 12 minutes to build, it keeps re-installing dependencies (around 5GB I believe) and making deployments slower, is this normal or am I once again doing something wrong?5 Replies
Project ID:
1790d4a8-0e32-4b4e-bf67-6ce23d7ae9e1
I have some suggestions before someone smarter than me comes and tells you the answer 🙂
Although it says HTTP you could try https instead of http.
Also have your app listen on the railway provided
port
environment variable if you aren't already.Just tried, still the same error as above and as far as im aware the port is set correctly.
thanks for the suggestions though!
You should bind your server on :: instead of 0.0.0.0, as privnets work over IPv6
If im correct, the server is binded to ::, unless im misunderstanding something...
Oops, nevermind, misread your message