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

a year 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

a year ago

003a76c4-4afd-4952-b4cf-cf7070c2917c


uwuread
PROOP

a year ago

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

1351526919614496800


brody
EMPLOYEE

a year ago

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


uwuread
PROOP

a year 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


brody
EMPLOYEE

a year ago

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


uwuread
PROOP

a year 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.


brody
EMPLOYEE

a year ago

looks like you have private networking disabled


brody
EMPLOYEE

a year ago

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


uwuread
PROOP

a year ago

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


uwuread
PROOP

a year ago

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


brody
EMPLOYEE

a year ago

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


uwuread
PROOP

a year ago

Thank you so much!


brody
EMPLOYEE

a year ago

all good?


uwuread
PROOP

a year ago

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


brody
EMPLOYEE

a year ago

branch?


uwuread
PROOP

a year ago

I mean this topic of discussion here


brody
EMPLOYEE

a year ago

ah, ill mark it as solved


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody 11 months ago


Loading...