unable to get my app to connect to redis
Anonymous
PROOP

3 months ago

it seems from the logs like i've got everything set up properly but the connection is dropping, plz help!

$10 Bounty

11 Replies

Railway
BOT

3 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


brody
EMPLOYEE

3 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 3 months ago


samgordon
PRO

3 months ago

Hi,

Can you share the error?

Additionally, have you read this page: https://docs.railway.com/reference/errors/enotfound-redis-railway-internal


Anonymous
PROOP

3 months ago

I am moving code that has been working on kubernetes, so whatever it is has to got to be something with how I'm setting the environment variables. My connection string seems right:

2025-11-04 17:22:13 [info]: connecting to redis at: redis://default:password@redis.railway.internal:6379/0

2025-11-04 17:22:14 [info]: [STARTUP] Starting core-api initialization...

2025-11-04 17:22:14 [info]: [STARTUP] Step 1: Starting API server with Redis cache...

2025-11-04 17:22:14 [info]: redis connection ready

2025-11-04 17:22:14 [error]: ========== APPLICATION STARTUP FAILURE ==========

2025-11-04 17:22:14 [error]: Connection Type: REDIS

2025-11-04 17:22:14 [error]: Error Type: Error

2025-11-04 17:22:14 [error]: Error Message: Connection is closed.

2025-11-04 17:22:14 [error]: Full Error Object:

2025-11-04 17:22:14 [error]: Stack Trace:

2025-11-04 17:22:14 [error]: Error: Connection is closed.

at Redis.connectionCloseHandler (/usr/src/app/node_modules/.pnpm/ioredis@4.30.0/node_modules/ioredis/built/redis/index.js:367:24)

at Object.onceWrapper (node:events:639:26)

at Redis.emit (node:events:524:28)

at Redis.emit (node:domain:489:12)

at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

2025-11-04 17:22:14 [error]: ================================================

2025-11-04 17:22:14 [error]: Killing application due to bad startup - REDIS connection closed; Connection is closed.


I am moving code that has been working on kubernetes, so whatever it is has to got to be something with how I'm setting the environment variables. My connection string seems right:2025-11-04 17:22:13 [info]: connecting to redis at: redis://default:password@redis.railway.internal:6379/02025-11-04 17:22:14 [info]: [STARTUP] Starting core-api initialization...2025-11-04 17:22:14 [info]: [STARTUP] Step 1: Starting API server with Redis cache...2025-11-04 17:22:14 [info]: redis connection ready2025-11-04 17:22:14 [error]: ========== APPLICATION STARTUP FAILURE ==========2025-11-04 17:22:14 [error]: Connection Type: REDIS2025-11-04 17:22:14 [error]: Error Type: Error2025-11-04 17:22:14 [error]: Error Message: Connection is closed.2025-11-04 17:22:14 [error]: Full Error Object:2025-11-04 17:22:14 [error]: Stack Trace:2025-11-04 17:22:14 [error]: Error: Connection is closed.at Redis.connectionCloseHandler (/usr/src/app/node_modules/.pnpm/ioredis@4.30.0/node_modules/ioredis/built/redis/index.js:367:24)at Object.onceWrapper (node:events:639:26)at Redis.emit (node:events:524:28)at Redis.emit (node:domain:489:12)at process.processTicksAndRejections (node:internal/process/task_queues:77:11)2025-11-04 17:22:14 [error]: ================================================2025-11-04 17:22:14 [error]: Killing application due to bad startup - REDIS connection closed; Connection is closed.

samgordon
PRO

3 months ago

Can you just make sure you have ?family=0 at the end of your Redis URL? It can cause a bunch of issues with ioredis if you don't.


Anonymous
PROOP

3 months ago

Ok, I am trying now to connect on my local machine, to the hosted redis via public url:

2025-11-05 10:10:04 [info]: connecting to redis at: redis://default:password@tramway.proxy.rlwy.net:29530?family=0

2025-11-05 10:10:05 [info]: redis connection ready

2025-11-05 10:11:36 [error]: Killing application due to bad startup; Connection is closed. {}


Ok, I am trying now to connect on my local machine, to the hosted redis via public url:2025-11-05 10:10:04 [info]: connecting to redis at: redis://default:password@tramway.proxy.rlwy.net:29530?family=02025-11-05 10:10:05 [info]: redis connection ready2025-11-05 10:11:36 [error]: Killing application due to bad startup; Connection is closed. {}

samgordon
PRO

3 months ago

Can you please add more logging to your application and have it display the actual error?

Also, I notice you're using the proxy IP, when you should be using an internal IP.


Anonymous
PROOP

3 months ago

I'm trying to at least get my local machine running the app connected to the redis so I can debug what's going, I can't use the internal IP for that can I?


Anonymous
PROOP

3 months ago

Error: Connection is closed.

at Redis.connectionCloseHandler (/Users/brandon/Projects/atlantic-dawn-monorepo/node_modules/.pnpm/ioredis@4.30.0/node_modules/ioredis/built/redis/index.js:367:24)

at Object.onceWrapper (node:events:639:26)

at Redis.emit (node:events:524:28)

at Redis.emit (node:domain:489:12)

at processTicksAndRejections (node:internal/process/task_queues:77:11) is all I get


Anonymous
PROOP

3 months ago

ahh I've found out that it's actually this that's causing the crash, not my normal redis connection I thought it was....

cache: [ { name: 'redis-cache', provider: { constructor: CatboxRedis, options: { partition: 'core-api-cache', host: redis.options.host, port: redis.options.port, database: 0 } } } ]

redis.options:
{

"username": "default",

"password": "password",

"host": "tramway.proxy.rlwy.net",

"port": 29530,

"family": 0,

"showFriendlyErrorStack": true,

"connectTimeout": 10000,

"disconnectTimeout": 2000,

"keepAlive": 0,

"noDelay": true,

"connectionName": null,

"disableClientInfo": false,

"sentinels": null,

"name": null,

"role": "master",

"natMap": null,

"enableTLSForSentinelMode": false,

"updateSentinels": true,

"failoverDetector": false,

"db": 0,

"enableOfflineQueue": true,

"enableReadyCheck": true,

"autoResubscribe": true,

"autoResendUnfulfilledCommands": true,

"lazyConnect": false,

"keyPrefix": "",

"reconnectOnError": null,

"readOnly": false,

"stringNumbers": false,

"maxRetriesPerRequest": 20,

"maxLoadingRetryTime": 10000,

"enableAutoPipelining": false,

"autoPipeliningIgnoredCommands": [],

"sentinelMaxConnections": 10

}


Anonymous
PROOP

3 months ago

its something with how: import CatboxRedis from '@hapi/catbox-redis' tries to connect


Anonymous
PROOP

3 months ago

Well, I've gone ahead and removed catbox, this was an unneccasary optimization


Status changed to Open brody 3 months ago


Loading...