2 years ago
My service uses DATABASEPRIVATEURL to connect to db. If i run "railway run xx" connection to DB wont work.
What's the suggested way to work around this?
5 Replies
2 years ago
I had the same issue!
It's bc you are trying to connect from your home network and DATABASEPRIVATEURL only works in the railway internal network. So you should use the DATABASE_URL if you want to connect from your terminal (that env gives access to networks outside railway cloud environment).
2 years ago
But in order to do this I need to redeploy the service, right?
2 years ago
yes
2 years ago
As feedback for the product this doesn’t seem good ux considering private networking is the recommended connection to db services.
2 years ago
Yep, @fvr1 is right!
This is great feedback - there's some disconnect on private networking and local dev using CLI currently. While the recommended way to connect to DB services within Railway is via private networking, we don't yet expose any sort of tunneling capability via the CLI, so you'll have to use the public URL to connect from any non-Railway clients.