PostgreSQL & NestJs deployment failure
rick002
FREEOP

2 years 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

2 years ago

What issues are you running into exactly?


rick002
FREEOP

2 years 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".


2 years ago

Have you setup all the needed environment variables?


rick002
FREEOP

2 years ago

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


rick002
FREEOP

2 years ago

Where do I find information about these environment variables?


2 years ago

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


rick002
FREEOP

2 years ago

This is the list, Am I missing something?DB_HOST

DB_PORT

HOST

PASSWORD

PORT

USER_NAME


2 years ago

These are not all environment variables for a database.

I would recommend using DATABASE_URL


rick002
FREEOP

2 years 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
FREEOP

2 years ago

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


2 years ago

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


rick002
FREEOP

2 years ago

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

Attachments


rick002
FREEOP

2 years 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.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...