R
Railwayβ€’2mo ago
jtourkos

Cannot connect to Redis via Private Network

In my nodejs app I create a BeeQueue instance like:
const eventProcessingQueue = new BeeQueue(`queue_name`, {
redis: { url: appSettings.redisConnectionString },
});
const eventProcessingQueue = new BeeQueue(`queue_name`, {
redis: { url: appSettings.redisConnectionString },
});
appSettings.redisConnectionString is set - correctly - to the internal Redis URL, but when trying to deploy (after successfully building), I get Redis connection to redis.railway.internal:6379 failed - getaddrinfo ENOTFOUND redis.railway.internal. Switching to the public URL, works fine. Tried appending family=6 (and 0 which is the default) at the connection string. Also tried creating a redis client and seting the socket family to 6 but then it fails for another reason (trying to connect to localhost). I also have setup a sleep when starting. The service I'm connecting from and the redis instance, both are in the same project. Any ideas? Thank you!
25 Replies
Percy
Percyβ€’2mo ago
Project ID: N/A
jtourkos
jtourkosOPβ€’2mo ago
N/A
Brody
Brodyβ€’2mo ago
please read this docs section - https://docs.railway.app/guides/private-networking#ioredis you might not be directly using ioredis, but more than likely it's what beequeue is using under the hood
jtourkos
jtourkosOPβ€’2mo ago
Hi @Brody πŸ‘‹ I already tried that, still the same issue. Beequeue uses https://github.com/redis/node-redis.
Brody
Brodyβ€’2mo ago
does it use some very old version of that module? perhaps before it supported ipv6
jtourkos
jtourkosOPβ€’2mo ago
If you check here https://github.com/redis/node-redis/blob/master/docs/client-configuration.md I also tried setting socket.family to 6
Brody
Brodyβ€’2mo ago
okay fair, are you getting these errors locally on when on Railway
jtourkos
jtourkosOPβ€’2mo ago
The only difference is that when I try something like
const redisClient = createClient({
url: appSettings.redisConnectionString,
socket: {
family: 6,
},
});
const redisClient = createClient({
url: appSettings.redisConnectionString,
socket: {
family: 6,
},
});
i now get the same error but it tries to connect to localhost
Brody
Brodyβ€’2mo ago
that just means that's incorrect syntax and the client is falling back to it's default values for the host ?
jtourkos
jtourkosOPβ€’2mo ago
on Railway after building while deploying
Brody
Brodyβ€’2mo ago
is redis in the same project?
jtourkos
jtourkosOPβ€’2mo ago
yeah
Brody
Brodyβ€’2mo ago
are you pro?
jtourkos
jtourkosOPβ€’2mo ago
yup
Brody
Brodyβ€’2mo ago
can you try switching to the v2 runtime in the service settings
jtourkos
jtourkosOPβ€’2mo ago
where is that?
Brody
Brodyβ€’2mo ago
in the service settings
jtourkos
jtourkosOPβ€’2mo ago
i don't see such a setting πŸ€”
jtourkos
jtourkosOPβ€’2mo ago
Yeah, i know where the service settings are, I just don't find something to switch to v2 πŸ™‚
Brody
Brodyβ€’2mo ago
oh my bad, sorry for assuming
jtourkos
jtourkosOPβ€’2mo ago
no worries πŸ™‚
Brody
Brodyβ€’2mo ago
let me get back to you when I'm at my computer, might end up needing a minimal reproducible example
jtourkos
jtourkosOPβ€’2mo ago
Alright, thanks!
Brody
Brodyβ€’2mo ago
and I'll need a project id for that and unless it's super obvious, a service and environment name so I know I'm looking at the right stuff
Want results from more Discord servers?
Add your server