PostgreSQL & NestJs deployment failure
rick002
HOBBYOP

a year ago

I need to deploy my backend service and get it connected to postgres but I can't. Where do I find more information regard this topic?

13 Replies

brody
EMPLOYEE

a year ago

What issues are you running into exactly?


rick002
HOBBYOP

a year ago

I deployed a REST API built in NestJs, it supposed to be connected to a PostgreSQL database. The build and deployment phases are successful, but from the nestjs perspective, I'm not able to access the service using the railway URL and Service is not able to stablish the connection to the database. PostgreSQL says "Database does not exists".


brody
EMPLOYEE

a year ago

Have you setup all the needed environment variables?


rick002
HOBBYOP

a year ago

I'm not sure what are all the required environment variables, it might be the problem.


rick002
HOBBYOP

a year ago

Where do I find information about these environment variables?


brody
EMPLOYEE

a year ago

You need to add the applicable environment variables that your app needs.


rick002
HOBBYOP

a year ago

This is the list, Am I missing something?DB_HOST

DB_PORT

HOST

PASSWORD

PORT

USER_NAME


brody
EMPLOYEE

a year ago

These are not all environment variables for a database.

I would recommend using DATABASE_URL


rick002
HOBBYOP

a year ago

Yeah, but what if I don't need this URL to run my service in local environment? Does railway uses this URL in order to work properly?


rick002
HOBBYOP

a year ago

Do you have a NestJS Stater kit that I could check?


brody
EMPLOYEE

a year ago

Your code would need to use it to connect to the database.


rick002
HOBBYOP

a year ago

I'm using TypeOrm, just the connection string parameters are mandatory.

Attachments


rick002
HOBBYOP

a year ago

I saw the problem, there was a mismatch between the name of the environment variables name provided from railway, and the environment variables that my service is using.


Loading...