Problem with connecting to postgres private url (nest app with typorm)
uwuread
PROOP

2 years ago

Currently I have my app running on railway with postgres, but the app is connected to db via hostname + port + etc instead of URL. And it's via external url. When I try change to internal my app crushes, same with when I'm trying to use a URL: I get an error

Error during migration run: TypeError: Invalid URL

I suspect there must be problem with that I launch migrations in dockerfile entrypoint (which calls npm run typeorm:run-migrations:prod && npm run start:prod)

I tried to find some guides on how to correctly set it all up but couldn't find any, so I'm asking here for help.

Thank you in advance.

Solved

18 Replies

uwuread
PROOP

2 years ago

003a76c4-4afd-4952-b4cf-cf7070c2917c


uwuread
PROOP

2 years ago

I tried to remove migrations. I continue to get this error when using internal db url

1351526919614496800


2 years ago

have you verified that the URL is valid to begin with?


uwuread
PROOP

2 years ago

I have environment variable. DB_URL. Locally everything works fine. On the railway when I put there ${{Postgres.DATABASE_URL}} everything works like a charm but with${{Postgres.DATABASE_PRIVATE_URL}}I get the abovementioned error. Copying value directly and putting it in the field also gives error

1351555791240429599


2 years ago

so if you saved that reference value and then copied its value it would indeed be the correct url?


uwuread
PROOP

2 years ago

I don't understand your question, sorry. Do you ask if I checked spelling? I copy pasted it directly from and tried alternatively copy pasting not the name of the reference but the value itself.


2 years ago

looks like you have private networking disabled


2 years ago

go ahead and enable that from within the service settings (doesnt matter what service)


uwuread
PROOP

2 years ago

Yeah hostname was empty and new URI() didn't like it

Thank you, trying it out!


uwuread
PROOP

2 years ago

Can you please point me to which sleep command will work in railway environment?


2 years ago

switch your runtime to v2 and you wont need to use sleep


uwuread
PROOP

2 years ago

Thank you so much!


2 years ago

all good?


uwuread
PROOP

2 years ago

Yes, it is perfect. I have to close the branch?


2 years ago

branch?


uwuread
PROOP

2 years ago

I mean this topic of discussion here


2 years ago

ah, ill mark it as solved


2 years ago

!s


Status changed to Solved brody • over 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...