R
Railway

✋|help

One service is unable to connect to Postgres container, while the other connects fine

Sspacemandev9/2/2023
Hi, I have two typescript services and a postgres service in a project. One of the typescript services is able to connect to the postgres service totally fine while the second one can't.
Sspacemandev9/2/2023
c7f62dd5-665b-4f22-9f49-a2a9e9b19231
Bbrody1929/2/2023
can you show me a screenshot of the service variables for the service that can't connect?
Sspacemandev9/2/2023
they are the same on both services ( i copy pasted from the one that can connect to the one that can't)
Bbrody1929/2/2023
you shouldn't copy paste the database variables, please delete that database variable and setup a variable reference like that popup wants you to
Sspacemandev9/2/2023
okay, set up a variable reference, but still same error
Bbrody1929/2/2023
can I see another screenshot, just as a sanity check
Sspacemandev9/2/2023
'
Bbrody1929/2/2023
perfect
side note, your other service should be using a variable reference if it's not already, don't worry about it stopping working, we will get to the bottom of this
so now please show me the error you get
Sspacemandev9/2/2023
Sspacemandev9/2/2023
the service isn't using a variable reference right now cause for production i'm planning on moving to neon.tech for my postgres deploy, and use railway for just the services
Bbrody1929/2/2023
gotcha
are you utilizing the private network at all?
Sspacemandev9/2/2023
nope
Bbrody1929/2/2023
wanna go ahead and disable it?
Sspacemandev9/2/2023
disabled
redeploying
Bbrody1929/2/2023
let the stuff redeploy and get back to me
Sspacemandev9/2/2023
ooh looks like disabling private networking fixed it! the service is working!
thank you!
Bbrody1929/2/2023
okay so why it works, private networking takes about 2 seconds to fully initialise and this can effect calls to things that are not on the private network, if you did happen to be using private networking then you would have needed to increase the timeout to the connection to postgres, but I don't know how that's handled in prisma? maybe a query parameter on the database url variable
Sspacemandev9/2/2023
is there a reason my other service worked fine?
cause that also uses prisma
maybe just cause it has an express server and that took the required amount of time before prisma kicked in?
oh i guess prisma would only kick in on the working service when i got an inbound request
which would be long enough time for private networking to have initialize
Bbrody1929/2/2023
there are many factors, one of the factors I can comment on would be that private networking initialisation times vary slightly
Sspacemandev9/2/2023
vs the service that wasn't working, where it's a cron script that calls the db straight away
Bbrody1929/2/2023
ah yes if the connection to the database isn't done at app start then initialisation times for the private network wouldn't come into play
Sspacemandev9/2/2023
so i could've solved with even just a regular promise timeout in the service that wasn't working before the prisma network initialized. cool, good to know! thank you 😄
Bbrody1929/2/2023
awaiting a promise timeout, slapping a sleep 2 && onto the start command, increasing connection timeout, use pg_isready
many solutions, all which I wish we didn't have to do
this could even effect a connection attempt to neon if the connection is done at app start

Looking for more? Join the community!

Recommended Posts
Go Deploy Gone WrongHey all, need a sanity check on a failing deploy. I am able to build and run my app locally just finNeed Help with Discord BotThe bot uses chatgpt and play.ht to generate text, and then read the text in a discord server. When Deploying without having to do npx playwright install-depsHello, I'm deploying a node.js application that is using playwright, and it needs some dependencies Nuxt 3 DeployHi, has anyone done nuxt 3 deploy yet? What do I have to set? Is there a specific setting in nuxt.co'The information you’re about to submit is not secure'I have a very simple fastAPI page that I just began hosting through github on railway. It has a textPayment shows unsuccessful even though it's notHello, I got an email today morning about last month usage (1 Aug - 1 Sep) payment shows unsuccessfDeployment issues in Spring Boot projectHello, I am a newcomer using the Hobby Plan. My project is built on the Spring Boot platform and runBackup DatabaseHi, is it possible to perform or schedule database backups on railway? If so, could you explain howIssuing TLS certificate ongoing for 4 days nowHey folks, I've added a CNAME dns on my domain on Monday, and then it changed the status on the railfrontend web app making requests to wrong endpointOn my frontend web app I have a env variable configured to be the endpoint of my application but wheI have run graphql api for railway, I want to know how I can add custom domain by using this api.from the graph ql api, I can query project info and add plugins to project. But I do not know how toIs there an easy way to pause a project?Hello, we have a secondary development environment that we need for testing every once in a while. Ideployed flowise bot, no url generatedI have deployed a flowise bot and I have a hobby tier on railway. The issue is that after the deployDoes anyone know how to enable mongoDB drivers in a php/laravel project?Y tried to added with this command in the env tab NIXPACKS_PKGS=php81Extensions.mongodb But it stillInstalling php-gd extensionIs there a way for me to use Nixpacks to install php-gd in the setup stage of the build process. Or bind [::1]:5433: Cannot assign requested addressI'm trying to use an SSH tunnel and need to bind to my local port 5433 but keep getting this error. charged for hobby plan ?I have been charged 5 dollars for the hobby plan whilst my usage was below it and every month i had Custom Domain - Waiting for DNS updateI have deployed an app on Railway and set up a custom domain. I've tried to get the custom domain tDeployment has crashed with FileNotFoundError: [Errno 2]Hi. I am have problem with my JSON file. I try to deploy my flask chatbot project the have function nocodb - update failedHi I am testing the railway nocodb hosting, I was informed by the nocodb that there is an update tha