Connecting Redis, index is out of range

kareemabbas1
PRO

a year ago

I'm trying to connect Redis to a service running the backend. I'm getting the following error from ioredis.

[ioredis] Unhandled error event: ReplyError: ERR DB index is out of range

Sep 08 16:51:40

at parseError (/app/node_modules/redis-parser/lib/parser.js:179:12)

Sep 08 16:51:40

at parseType (/app/node_modules/redis-parser/lib/parser.js:302:14)

Sep 08 16:51:40

Connection to Redis in module 'event-bus-redis' established

ReplyError: ERR DB index is out of range

Sep 08 16:51:40

at parseError (/app/node_modules/redis-parser/lib/parser.js:179:12)

Sep 08 16:51:40

at parseType (/app/node_modules/redis-parser/lib/parser.js:302:14) {

Sep 08 16:51:40

command: { name: 'select', args: [ '22' ] }

Sep 08 16:51:40

}

2 Replies

a year ago

This would be an issue with how you are attempting to open a connection with redis, please reference the applicable docs for your redis client.


kareemabbas1
PRO

a year 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/failure-connecting-redis-service-to-medu-3057e814
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