Handoff: Fix Redis Connection — 3 Railway Services

Change REDIS_PRIVATE_URL → REDIS_URL reference in backend-api, backend-ai-api, backend-docs-api

Handoff: Fix Redis Connection — 3 Railway Services

From: Session 128.2 (Cursor Agent) To: Browser Agent (needs GitHub auth) OR manual action Priority: CRITICAL — 3 of 4 backends have broken Redis Time: ~2 minutes (3 variable edits) Proven: Same fix already applied and verified on backend-vitto-api


Root Cause (Confirmed)

${{Redis.REDIS_PRIVATE_URL}} resolves to redis://default:***@127.0.0.1:6379 — a Railway auto-generated variable that points to localhost (only valid inside the Redis container itself).

${{Redis.REDIS_URL}} resolves to redis://default:***@redis.railway.internal:6379 — the actual private domain that works for inter-service communication.


Fix: Change 3 Variables

Railway project: https://railway.com/project/3990549d-4313-47e4-9682-d17b382bdba2

For each service below: click service → Variables tab → edit REDIS_URL value → save.

# Service Variable Change FROM Change TO
1 backend-api (api.gograb.space) REDIS_URL ${{Redis.REDIS_PRIVATE_URL}}/1 ${{Redis.REDIS_URL}}/1
2 backend-ai-api (ai-api.gograb.space) REDIS_URL ${{Redis.REDIS_PRIVATE_URL}}/2 ${{Redis.REDIS_URL}}/2
3 backend-docs-api (docs-api.gograb.space) REDIS_URL ${{Redis.REDIS_PRIVATE_URL}}/3 ${{Redis.REDIS_URL}}/3

Service 4: backend-vitto-api (rename variable)

On Railway, rename the variable from VITTO_REDIS_URL to REDIS_URL (keep the value ${{Redis.REDIS_URL}}/0). The code has been updated to read REDIS_URL instead of VITTO_REDIS_URL.


Verification

Each variable change triggers an auto-redeploy. After deploy completes (~2-3 min each):

  1. Check Deploy Logs for each service
  2. Look for: LOG [RedisService] Redis connected — confirms fix worked
  3. Confirm no more: WARN [RedisService] Redis connection failed messages
  4. Redis Metrics should show 3 new connections (in addition to vitto's existing one)

Notes