#Npgsql.npgsqlException (0x80004005) Failed to connect to 76.76.21.21:5432

35 messages · Page 1 of 1 (latest)

tranquil hatch
#

Hi! im trying to connect to an ASP.Net core 6 to railway.app for the first time and i receive the indicated error message. can somebody help me? Npgsql.npgsqlException (0x80004005) Failed to connect to 76.76.21.21:5432

limpid ploverBOT
#

Project ID: a19b97b8-4fef-403c-afd7-4ce7f8a5b775

rotund ferryBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

tranquil hatch
#

a19b97b8-4fef-403c-afd7-4ce7f8a5b775

lusty dagger
#

is your database hosted on Vercel?

tranquil hatch
#

i dont know

#

im using postgreSQL

lusty dagger
#

that errors mean you're trying to connect to an IP from Vercel on the 5432 port, you probably don't want that

#

did you created a postgres database in railway?

tranquil hatch
#

yes

#

is empty

lusty dagger
#

did you set the enviroment variables correctly?

tranquil hatch
#

no, i didnt set anything

#

i followed a youtube tutorial and they dont explained there

#

i supossed was not necessary

lusty dagger
#

ok so after you create a database on railway, you can reference the environment variables from there

#

and in your code you use that enviroment variables to start the connection.

tranquil hatch
#

ok, i will try

tranquil hatch
#

Hi! I don't understand how to do it. Is there some video to help with this?

frail blade
tranquil hatch
#

So, for example PGPORT = 3000 and fill out all the variables?

lusty dagger
#

When your service is deployed, an environment variable called PGPASSWORD (process.env.PGPASSWORD) can be used inside your service which will have your Postgres password.
And the value of it will not be the literal string ${{Postgres.PGPASSWORD}} it's just a reference, just like javascript's template literal.

tranquil hatch
#

so, should i add which variables? DATABASE_URL and something more?

lusty dagger
tranquil hatch
#

is this way correct?

tranquil hatch
lusty dagger
tranquil hatch
#

So, i dont understand what can be the problem

#

i think it could be very usefull some explainatory videos for the new to programming

tranquil hatch
near scaffold
#

Describe 'Doesn't work', your app is loading fine for me.

frail matrix
#

looks good to me as well 👍