Redis Client Failing to Connect with ECONNREFUSED Error in Production

paanchibanu
TRIAL

10 months ago

I've set up my Next.js application on Railway with a Redis service using the following environment variable in the .env.local file:

REDIS_URL=redis://default:isIbIBhldICphisoWHeJolXEXjouPdkc@junction.proxy.rlwy.net:44412

However, during the build and deployment process, I keep encountering the following error:

Redis Client Error Error: connect ECONNREFUSED 127.0.0.1:6379

This error suggests that the Redis client is attempting to connect to the local Redis server (127.0.0.1) instead of using the provided REDIS_URL. I've double-checked the environment variable setup and the Redis client initialization code.

Please advise on how to resolve this issue.

Project: my-auth-backend

Logs:

  • The error occurs during the build process when trying to connect to Redis.

    Full errorr

  • Redis Client Error Error: connect ECONNREFUSED 127.0.0.1:6379

Additional Context:

  • The issue persists even after ensuring the REDIS_URL environment variable is correctly set.

2 Replies

10 months ago

You have not set any variables in your service variables tab.


paanchibanu
TRIAL

10 months ago

But i Set for Redis..to first solved redis issues