R
Railway•7mo ago
cucaracha

websocket server cannot connect to redis

ive a websocket server and a redis server hosted on railway. after the migration, my ws server can no longer connect to my redis server. ive tried both the redis url and redis private url but i get the same error:
node:internal/process/promises:288

triggerUncaughtException(err, true /* fromPromise */);

^

ConnectionTimeoutError: Connection timeout

at Socket.<anonymous> (/app/node_modules/@redis/client/dist/lib/client/socket.js:177:124)

at Object.onceWrapper (node:events:631:28)

at Socket.emit (node:events:517:28)

at Socket._onTimeout (node:net:598:8)

at listOnTimeout (node:internal/timers:569:17)

at process.processTimers (node:internal/timers:512:7)

Emitted 'error' event on Commander instance at:

at RedisSocket.<anonymous> (/app/node_modules/@redis/client/dist/lib/client/index.js:412:14)

at RedisSocket.emit (node:events:517:28)

at RedisSocket._RedisSocket_connect (/app/node_modules/@redis/client/dist/lib/client/socket.js:166:18)

at processTicksAndRejections (node:internal/process/task_queues:95:5)

at runNextTicks (node:internal/process/task_queues:64:3)

at listOnTimeout (node:internal/timers:538:9)

at process.processTimers (node:internal/timers:512:7)

at async Commander.connect (/app/node_modules/@redis/client/dist/lib/client/index.js:185:9)

Node.js v18.19.1
node:internal/process/promises:288

triggerUncaughtException(err, true /* fromPromise */);

^

ConnectionTimeoutError: Connection timeout

at Socket.<anonymous> (/app/node_modules/@redis/client/dist/lib/client/socket.js:177:124)

at Object.onceWrapper (node:events:631:28)

at Socket.emit (node:events:517:28)

at Socket._onTimeout (node:net:598:8)

at listOnTimeout (node:internal/timers:569:17)

at process.processTimers (node:internal/timers:512:7)

Emitted 'error' event on Commander instance at:

at RedisSocket.<anonymous> (/app/node_modules/@redis/client/dist/lib/client/index.js:412:14)

at RedisSocket.emit (node:events:517:28)

at RedisSocket._RedisSocket_connect (/app/node_modules/@redis/client/dist/lib/client/socket.js:166:18)

at processTicksAndRejections (node:internal/process/task_queues:95:5)

at runNextTicks (node:internal/process/task_queues:64:3)

at listOnTimeout (node:internal/timers:538:9)

at process.processTimers (node:internal/timers:512:7)

at async Commander.connect (/app/node_modules/@redis/client/dist/lib/client/index.js:185:9)

Node.js v18.19.1
36 Replies
Percy
Percy•7mo ago
Project ID: 57346011-633f-4c77-851f-83e2a6f54bc0
cucaracha
cucaracha•7mo ago
57346011-633f-4c77-851f-83e2a6f54bc0
Brody
Brody•7mo ago
can you connect to the database with something like dbgate?
cucaracha
cucaracha•7mo ago
ive tried connecting from local host with the redis url and it works fine
Brody
Brody•7mo ago
okay thats good have you updated the environment variables you use?
cucaracha
cucaracha•7mo ago
yes. i went into my ws server environment variables and added the redis url as a reference variable ${{Redis.REDIS_URL}}
Brody
Brody•7mo ago
show me the client code that connects to redis please
cucaracha
cucaracha•7mo ago
import { createClient } from "redis";

const redisUrl = process.env.REDIS_URL;

const redisCon = {
url: redisUrl,
};
import { createClient } from "redis";

const redisUrl = process.env.REDIS_URL;

const redisCon = {
url: redisUrl,
};
if i run the ws server locally with this exact code with the REDIS_URL set to the one found in railway redis variables, it works fine
Brody
Brody•7mo ago
and can i see your service variables?
cucaracha
cucaracha•7mo ago
do you just mean these?
No description
cucaracha
cucaracha•7mo ago
the redis url was cut off at the bottom. heres a better ss
No description
Brody
Brody•7mo ago
these are service variables from the redis service, please show me the variables on your apps service
cucaracha
cucaracha•7mo ago
No description
Brody
Brody•7mo ago
what is the raw value of the redis url
cucaracha
cucaracha•7mo ago
isnt that sensitive? can i post it here?
Want results from more Discord servers?
Add your server