Failure connecting Redis to service

kareemabbas1
HOBBY

10 months ago

I'm deploying Medusa.js application and trying to connect Redis to my backend service.

When I use the variable "Redis.REDIS_URL" I get the following error:
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal

Sep 04 16:11:07

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)

Sep 04 16:11:07

Error: getaddrinfo ENOTFOUND redis.railway.internal

Sep 04 16:11:07

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {

Sep 04 16:11:07

errno: -3007,

Sep 04 16:11:07

code: 'ENOTFOUND',

Sep 04 16:11:07

syscall: 'getaddrinfo',

Sep 04 16:11:07

hostname: 'redis.railway.internal'

Sep 04 16:11:07

}
And when I use the variable "Redis.REDIS_PUBLIC_URL" the log shows that the connection to Redis is established, but I get the following error which as I thing indicates that the connection is not successful mostly because I'm using Redis public url:
level: "error" stack: [ ] 0: { } columnNumber: 19 fileName: "/app/node_modules/bullmq/dist/cjs/classes/queue-base.js" functionName: "new QueueBase" lineNumber: 36 methodName: null native: false typeName: null 1: { } columnNumber: 9 fileName: "/app/node_modules/bullmq/dist/cjs/classes/queue.js" functionName: "new Queue" lineNumber: 18 methodName: null native: false typeName: null 2: { } columnNumber: 27 fileName: "/app/node_modules/@medusajs/medusa/dist/services/job-scheduler.js" functionName: "new JobSchedulerService" lineNumber: 122 methodName: null native: false typeName: null 3: { } columnNumber: 82 fileName: "/app/node_modules/@medusajs/medusa/dist/loaders/services.js" functionName: null lineNumber: 26 methodName: null native: false typeName: null 4: { } columnNumber: 20 fileName: "/app/node_modules/awilix/lib/resolvers.js" functionName: "Object.resolve" lineNumber: 295 methodName: "resolve" native: false typeName: "Object" 5: { } columnNumber: 45 fileName: "/app/node_modules/awilix/lib/container.js" functionName: "Object.resolve" lineNumber: 268 methodName: "resolve" native: false typeName: "Object" 6: { } columnNumber: 63 fileName: "/app/node_modules/@medusajs/medusa/dist/loaders/helpers/jobs/index.js" functionName: null lineNumber: 193 methodName: null native: false typeName: "ScheduledJobsLoader" 7: { } columnNumber: 23 fileName: "/app/node_modules/@medusajs/medusa/dist/loaders/helpers/jobs/index.js" functionName: "step" lineNumber: 56 methodName: null native: false typeName: null 8: { } columnNumber: 53 fileName: "/app/node_modules/@medusajs/medusa/dist/loaders/helpers/jobs/index.js" functionName: "Object.next" lineNumber: 37 methodName: "next" native: false typeName: "Object" 9: { } columnNumber: 71 fileName: "/app/node_modules/@medusajs/medusa/dist/loaders/helpers/jobs/index.js" functionName: null lineNumber: 31 methodName: null native: false typeName: null timestamp: "2024-09-04 10:54:34"

5 Replies

kareemabbas1
HOBBY

10 months ago

Seriously guys! It's been a whole day now and one is responding!!


10 months ago

Hello, Please keep in mind we don't have guaranteed response times for non platform issues for Hobby users.

I think this docs section will help you - https://docs.railway.app/guides/private-networking#known-configuration-requirements-for-ipv6


kareemabbas1
HOBBY

10 months ago

Is the error mentioned below also a non platform issue?
I also tried to append "?family=0" and "?family=6" to Redis URL and it didn't solve the problem.
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND fourpets-backend.railway.internal


kareemabbas1
HOBBY

10 months ago

I've trying to debug it for the past two and I made some changes. Currently, I'm facing the following error.

[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

}


kareemabbas1
HOBBY

9 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/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


Failure connecting Redis to service - Railway Help Station