8 months ago
I've been struggling for a long time now with configuring Redis service to connect to my backend service. I created previous threads about it and didn't get as much support. I was just told to check the following link, which I did. I appended "?family=0", and edited the server to add [::] before the port like the following:
`
app.listen(port, '::', () => {
console.log(`Server listening on [::]${port}`);
});
`
as mentioned on the Private networking documentation page. I also did some research and found another possible solution where I append "?family=6" instead of "?family=0" as mentioned in the docs and both solutions didn't work for me.
After all the tires I'm still getting the same error:[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal
I'm being told that this is a non-platform issue and due to the issue being a non-platform issue and I'm a hobby user response times aren't guaranteed. The only response I got in a few days was the link mentioned above, and as I said I didn't solve the problem. I'm not an expert on the topic so I can't determine whether it's a non-platform issue, but the expert said so. Anyway, I'm still stuck at this error so I would appreciate any help from the Railway team or the Public community.
5 Replies
8 months ago
In the project config:
```
redis_url: process.env.REDIS_URL + "?family=0",
In event-bus-redis and redis-cache modules:
```
eventBus: {
resolve: "@medusajs/event-bus-redis",
options: {
redisUrl: process.env.REDIS_URL + "?family=0",
},
},
cacheService: {
resolve: "@medusajs/cache-redis",
options: {
redisUrl: process.env.REDIS_URL + "?family=0",
ttl: 30,
},
},
Note: when I check the logs I see that connection to redis was established, connection to event-bus-redis was established, and connection to redis-cache was established.
As I mentioned I tried both family=0 and family=6
Connection to Redis established
Connection to Redis in module 'event-bus-redis' established
Connection to Redis in module 'cache-redis' established
8 months ago
Perhaps you are using an old version of ioredis that doesn't even support IPv6.
8 months ago
Honestly, I don't know. I just created a new service, choose database, and then Redis from the dropdown menu.
8 months ago
First of all, sorry for the disturbance and thank you for your support. Problem solved. You can mark this thread and all the related threads mentioned below as solved.
https://help.railway.app/questions/connecting-redis-index-is-out-of-range-706a44c1
https://help.railway.app/questions/failure-connecting-redis-to-service-2e061dde
https://help.railway.app/questions/failure-connecting-to-redis-d6372e31
After a long time of debugging the issue it turned out to be something related to one of Medusajs previous releases where the scheduled-jobs:queue was the name of the queue in BullMQ, which is a dependency package built in event-bus-redis and the issue was fixed by changing scheduled-jobs:queue to scheduled-jobs-queue by one of Medusa contributors, this is due to the BullMQ v5.12.12 update that throws an error whenever a Queue has a semicolon in its name. You can find the issue here If anyone runs into this issue in the future fix the issue by upgrading to Medusa version 1.20.10 which includes the new changes that address this issue. Run the following command.
npm install @medusajs/medusa@1.20.10
As for the [ioredis] issue just appending "?family=0" or "?family=6" to the Redis URL will solve the problem