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

uwuread
PRO

4 months 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

0 Replies

uwuread
PRO

4 months ago

003a76c4-4afd-4952-b4cf-cf7070c2917c


uwuread
PRO

4 months ago

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

1351526919614496800


4 months ago

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


uwuread
PRO

4 months 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

1351555791240429600


4 months ago

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


uwuread
PRO

4 months 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.


4 months ago

looks like you have private networking disabled


4 months ago

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


uwuread
PRO

4 months ago

Yeah hostname was empty and new URI() didn't like it
Thank you, trying it out!


uwuread
PRO

4 months ago

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


4 months ago

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


uwuread
PRO

4 months ago

Thank you so much!


4 months ago

all good?


uwuread
PRO

4 months ago

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


4 months ago

branch?


uwuread
PRO

4 months ago

I mean this topic of discussion here


4 months ago

ah, ill mark it as solved


4 months ago

!s


Status changed to Solved brody 5 months ago