Backend Not Connecting to PostgreSQL and Redis

ryux411
HOBBY

7 months ago

Hi Railway Support,

I am currently facing an issue with my backend deployment. I’ve successfully configured both PostgreSQL and Redis to be accessed via Railway’s private network, but my backend continues to fail to connect to both services, even though I have followed all the configuration steps carefully.

Error Details:

  • PostgreSQL: The backend connects to PostgreSQL initially, but fails to establish a stable connection.

  • Redis: The backend is unable to connect to Redis, showing the error ENOTFOUND undefined, indicating the hostname cannot be resolved.

Configurations:

  • I am using the internal network addresses (postgres.railway.internal for PostgreSQL and redis.railway.internal for Redis), but the connection attempts are not resolving correctly.

  • The .env file is correctly set up with the connection strings, and I am using the appropriate environment variables in my code.

What I’ve Tried:

  • I have updated the .env to include both PostgreSQL and Redis details (private network URLs).

  • I have tried switching the Redis connection to use dual-stack lookup (family=0 in the URL).

  • I have ensured that both the backend and database services are within the same Railway project and environment.

Despite all efforts, I keep receiving the following errors in the logs:

  • PostgreSQL Error:Error connecting to PostgreSQL: getaddrinfo ENOTFOUND postgres.railway.internal

  • Redis Error:Error connecting to Redis: getaddrinfo ENOTFOUND undefined

Request for Assistance:
Could you please assist me in resolving these connection issues? Specifically, I’m looking for guidance on ensuring that the backend correctly resolves and connects to the PostgreSQL and Redis services using Railway’s private network.

I am using the latest versions of the required packages (pg, ioredis, and dotenv), and I’ve set the backend to use ES modules as required.

Solved

0 Replies

ryux411
HOBBY

7 months ago

92f4bf28-94c3-4d17-9dcf-1169563f4ed9


ryux411
HOBBY

7 months ago

1329971626611179500
1329971626896523300


ryux411
HOBBY

7 months ago

1329972373163606000


ryux411
HOBBY

7 months ago

I'm terrible at this<:kekw:788259314607325204> I have been trying and trying.. just nothing..


7 months ago

can you send me a full browser screenshot


ryux411
HOBBY

7 months ago

1329972782674739500


7 months ago

can you disable ad block


ryux411
HOBBY

7 months ago

I have been looking like for hours trying to fix this, I guess I am just really stuck at this point.


ryux411
HOBBY

7 months ago

1moment


ryux411
HOBBY

7 months ago

1329973276205650000


7 months ago

refresh, and show me another screenshot please


ryux411
HOBBY

7 months ago

1329974030505218000


ryux411
HOBBY

7 months ago

Is this problem sort of related to the browser I am on?


7 months ago

yes, lets debug so that you can help save people in your situation


7 months ago

can you open that project in incognito?


ryux411
HOBBY

7 months ago

Sure


ryux411
HOBBY

7 months ago

Would you like me to share screen?


ryux411
HOBBY

7 months ago

1329975918600654800


7 months ago

is that the same browser?


ryux411
HOBBY

7 months ago

Yes


ryux411
HOBBY

7 months ago

Brave Browser


7 months ago

you can now see the missing deploy button right?


ryux411
HOBBY

7 months ago

Yeah look at this after I clicked that "deploy button" button.. it made 2 changes

1329976428736811000


ryux411
HOBBY

7 months ago

Now everything is good.. man did I think it was my terrible coding skills


7 months ago

well i also undid a bunch of things you shouldnt have done


ryux411
HOBBY

7 months ago

What have I done wrong?


7 months ago

you just tried setting so many things in your effort to get it working


7 months ago

not important though


ryux411
HOBBY

7 months ago

Too many variables and certain?


7 months ago

but you can understand your original issue, you did not see the deploy button when you wernt in incognito


7 months ago

missing deploy button was the issue


ryux411
HOBBY

7 months ago

It would be best to use a different browser ?


7 months ago

no, we would like to fix this


ryux411
HOBBY

7 months ago

Sure, what else can I help with?


7 months ago

to fix this we would need to reproduce your setup so that we can also see a missing deploy button on our machines


7 months ago

so switch back to your regular browser user and start disableing extentions one by one until the button comes back


ryux411
HOBBY

7 months ago

That button is supposed to be there all the time?


7 months ago

whenever there is a change you can apply, yes


7 months ago

like right now

1329977867194597400


ryux411
HOBBY

7 months ago

These are my only extensions used.

1329978009427513600


ryux411
HOBBY

7 months ago

1329978092999151600


7 months ago

is the button missing right now?


ryux411
HOBBY

7 months ago

No.

1329978232019226600
1329978232400904200


7 months ago

are you in incognito still?


ryux411
HOBBY

7 months ago

No


7 months ago

we haven't changed anything


7 months ago

so im at a loss here


ryux411
HOBBY

7 months ago

Huh so am I


7 months ago

enable ad block again and reload?


ryux411
HOBBY

7 months ago

1329978832819847200


ryux411
HOBBY

7 months ago

This is weird, would you like me to restart my PC to start over trouble shooting?


7 months ago

whatever it takes, if you can figure out the clear reproducible root cause ill give you a bounty of $20 in railway credits


ryux411
HOBBY

7 months ago

Enabled


ryux411
HOBBY

7 months ago

1329979420936765400
1329979421393682400


ryux411
HOBBY

7 months ago

Disabled

1329979493418274800
1329979493724717000


7 months ago

well that was fast


ryux411
HOBBY

7 months ago

Suddenly came across my mind.. after you mentioned the extensions im using


7 months ago

i'll verify this on our side, and if its reproducible, you will have yourself $20 in credits


ryux411
HOBBY

7 months ago

Sweet, glad I could help


7 months ago

do you need to be logged into the proton extension for it to erase the button?


ryux411
HOBBY

7 months ago

Hold on


ryux411
HOBBY

7 months ago

Only Proton Enabled

1329980413007102000
1329980413296246800


ryux411
HOBBY

7 months ago

Only Dark Mode Reader Enabled

1329980605147910100
1329980605492101000


ryux411
HOBBY

7 months ago

There you go

1329980719346221000
1329980719702868000


7 months ago

so that dark mode thing is the issue


ryux411
HOBBY

7 months ago

1329980829400567800


ryux411
HOBBY

7 months ago

The extension not even being used but turned on, is already making the button dissapear. Dark Mode reader once clicked makes websites turn into dark mode..


7 months ago

can you send the link to that extention?


ryux411
HOBBY

7 months ago

Sure hold on



7 months ago

oh wow that really messes up the ui


7 months ago

in so many ways


ryux411
HOBBY

7 months ago

Glad we found out, teached me a few things


7 months ago

we can't fix that on our side, you would need to not use it while on railway


ryux411
HOBBY

7 months ago

Yeah no worries, I will keep it disabled. Railway has a cool UI already compared to all these flashy websites =}


7 months ago

either way, credits have been awarded


ryux411
HOBBY

7 months ago

And if this is not a bug, I don't expect any reward. I am already very glad having my back-end configured the way it should be lol


ryux411
HOBBY

7 months ago

Oh lol


ryux411
HOBBY

7 months ago

Thank you very much


7 months ago

not a bug on our side, but I'm a man of my word


ryux411
HOBBY

7 months ago

Glad I moved to Railway, truly makes a difference


7 months ago

I'm happy you're happy, and if I may ask, where did you move from?


ryux411
HOBBY

7 months ago

I started with Heroku long time ago, eventually moved on to render. But in this whole time I was looking for something more centralised and user friendly compared to all these paywalls and nothing being unified. That sort of when I found out about Railway on youtube..


7 months ago

who's YouTube if you don't mind me asking?


ryux411
HOBBY

7 months ago

Hmm that's something I need to look up


7 months ago

no worries if you don't know off the top of your head


7 months ago

I only hope that you used their referral code 😉


ryux411
HOBBY

7 months ago

Oh I must have missed that lol, It was about a video related to "Best hosting platforms" or something and since watching that I didn't hestitate trying out Railway until couple weeks ago..


7 months ago

that's awesome, I'm glad we caught your eye


ryux411
HOBBY

7 months ago

Anyways thank you very much, and truly see potential of how driven the community is here compared to …


7 months ago

we hope you stick around!


7 months ago

!s


Status changed to Solved brody 7 months ago


Backend Not Connecting to PostgreSQL and Redis - Railway Help Station