R
Railwayβ€’16mo ago
Nando Aracena

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

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
25 Replies
Percy
Percyβ€’16mo ago
Project ID: a19b97b8-4fef-403c-afd7-4ce7f8a5b775
Nando Aracena
Nando AracenaOPβ€’16mo ago
a19b97b8-4fef-403c-afd7-4ce7f8a5b775
ThallesComH
ThallesComHβ€’16mo ago
is your database hosted on Vercel?
Nando Aracena
Nando AracenaOPβ€’16mo ago
i dont know im using postgreSQL
ThallesComH
ThallesComHβ€’16mo ago
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?
Nando Aracena
Nando AracenaOPβ€’16mo ago
yes is empty
ThallesComH
ThallesComHβ€’16mo ago
did you set the enviroment variables correctly?
Nando Aracena
Nando AracenaOPβ€’16mo ago
no, i didnt set anything i followed a youtube tutorial and they dont explained there i supossed was not necessary
ThallesComH
ThallesComHβ€’16mo ago
ok so after you create a database on railway, you can reference the environment variables from there
No description
ThallesComH
ThallesComHβ€’16mo ago
and in your code you use that enviroment variables to start the connection.
Nando Aracena
Nando AracenaOPβ€’16mo ago
ok, i will try Hi! I don't understand how to do it. Is there some video to help with this?
Adam
Adamβ€’16mo ago
the variables referenced above are available in your database. share those variables to your other services and reference them to connect
Nando Aracena
Nando AracenaOPβ€’16mo ago
So, for example PGPORT = 3000 and fill out all the variables?
ThallesComH
ThallesComHβ€’16mo ago
No, by reference we mean that the Postgres database fill out those for you automatically. So, if you choose PGPASSWORD from the dropdown above
No description
ThallesComH
ThallesComHβ€’16mo ago
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. See this for more docs https://docs.railway.app/develop/variables#reference-variables
Nando Aracena
Nando AracenaOPβ€’16mo ago
so, should i add which variables? DATABASE_URL and something more?
ThallesComH
ThallesComHβ€’16mo ago
by the look of asp.net core 6, you should use a DATABASE_URL and pass that to the LibraryContext class
Nando Aracena
Nando AracenaOPβ€’16mo ago
is this way correct?
Nando Aracena
Nando AracenaOPβ€’16mo ago
No description
ThallesComH
ThallesComHβ€’16mo ago
i'm not a C# expert but it looks correct
Nando Aracena
Nando AracenaOPβ€’15mo ago
So, i dont understand what can be the problem i think it could be very usefull some explainatory videos for the new to programming Hi! my app doesnt work i dont know what happen https://tangokultura.up.railway.app/
Medim
Medimβ€’15mo ago
Describe 'Doesn't work', your app is loading fine for me.
josh
joshβ€’15mo ago
looks good to me as well πŸ‘
Brody
Brodyβ€’15mo ago
me three
Want results from more Discord servers?
Add your server