Can't connect to internal redis with sails.js
jhud
PROOP

7 months ago

Hi! I am trying to connect to an internal redis server at standard redis.REDIS_URL address via connect and a sails.js app. The public URL works fine.

I have tried changing both @sailshq/socket.io-redis and @sailshq/connect-redis adapters to the internal URL, and it gives the error below.

I have added the following to the internal URL: ?family=0

I have also tried adding the separate address, user, password, port to the config.js to force it to not use tls.

Basically I tried all the solutions I found online. There are multiple other reports of this problem, but other bug tickets have just given up and ended up using the public url.

Anyone have any idea how to fix this?

Sorry, I can't find the appropriate project in the help form dropdown.

Thank you!

node:events:495
 throw er; // Unhandled 'error' event
 ^
AbortError: Connection forcefully ended and command aborted. It might have been processed.
 at RedisClient.flush_and_error (/app/node_modules/machinepack-redis/node_modules/redis/index.js:298:23)
 at RedisClient.end (/app/node_modules/machinepack-redis/node_modules/redis/lib/extendedApi.js:52:14)
 at RedisClient.onPreConnectionEnd (/app/node_modules/machinepack-redis/machines/get-connection.js:157:14)
 at RedisClient.emit (node:events:517:28)
 at RedisClient.connection_gone (/app/node_modules/machinepack-redis/node_modules/redis/index.js:526:14)
 at RedisClient.on_error (/app/node_modules/machinepack-redis/node_modules/redis/index.js:346:10)
 at Socket.<anonymous> (/app/node_modules/machinepack-redis/node_modules/redis/index.js:223:14)
 at Socket.emit (node:events:517:28)
 at emitErrorNT (node:internal/streams/destroy:151:8)
 at emitErrorCloseNT (node:internal/streams/destroy:116:3)
 at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on RedisClient instance at:
 at /app/node_modules/machinepack-redis/node_modules/redis/index.js:246:22
 at Object.callbackOrEmit [as callback_or_emit] (/app/node_modules/machinepack-redis/node_modules/redis/lib/utils.js:89:9)
 at Command.callback (/app/node_modules/machinepack-redis/node_modules/redis/lib/individualCommands.js:199:15)
 at RedisClient.flush_and_error (/app/node_modules/machinepack-redis/node_modules/redis/index.js:310:29)
 at RedisClient.end (/app/node_modules/machinepack-redis/node_modules/redis/lib/extendedApi.js:52:14)
 [... lines matching original stack trace ...]
 at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
 code: 'NR_CLOSED',
 command: 'AUTH',
 args: [ 'default', '<password redacted>' ]
}
Solved

8 Replies

Railway
BOT

7 months ago

Our team is working on getting back to you as soon as possible. In the meantime, we've found the following might help you get unlocked faster:

If you find the answer from one of these, please let us know by solving the thread! Otherwise, we’ll be in touch.


Question: do you know if Sails is binded to the IpV6 port?


Status changed to Awaiting User Response Railway 7 months ago


angelo-railway

Question: do you know if Sails is binded to the IpV6 port?

jhud
PROOP

7 months ago

Hi, where should I find this info? My image doesn't have netstat, redis-cli etc so railway ssh wasn't helping me. Is this info from Railway or do I have to get sails.js to print it? Thank you!


Status changed to Awaiting Railway Response Railway 7 months ago


ray-chen
EMPLOYEE

7 months ago

Could you try increasing the timeout?

Please link the Redis service here for us to take a look.


Status changed to Awaiting User Response Railway 7 months ago


jhud
PROOP

7 months ago

Redis connect_timeout is set to the default of 10 minutes - I don't think it's that. My redis is at https://railway.com/project/13318b64-35be-44d7-b02b-0acd073b861b/service/ac64df71-6681-401b-b6b0-6446ea5558c6?environmentId=b8fc6ad4-c8a9-40ae-a34a-269271fd2163

Is there any way I can hit the redis server from railway ssh, so I can check it manually? Netstat etc. are not part of the node.js image.

Thank you!


Status changed to Awaiting Railway Response Railway 7 months ago


brody
EMPLOYEE

7 months ago

My thoughts are that the outdated package machinepack-redis simply does not have support for connecting to a Redis database over IPv6.

https://github.com/sailshq/machinepack-redis/tree/master

A lot of the code is 7 - 9 years old.


Status changed to Awaiting User Response Railway 7 months ago


jhud
PROOP

7 months ago

Thanks for the hint. I tried running redis locally, with the following redis URL on my development sails.js server: "redis://[::1]:6379/0"

It worked fine, and I inspected the redis object and it found family: 6, which suggests to me that the sails.js framework I am using can handle IPv6 OK.

Are there any other debugging tools which I can use on the server side to see what is going on with the network? Thank you!


Status changed to Awaiting Railway Response Railway 7 months ago


brody
EMPLOYEE

7 months ago

Counter offer, you give us an MRE and I'll try my best to tell you what is going wrong.


Status changed to Awaiting User Response Railway 7 months ago


Railway
BOT

6 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 6 months ago


Loading...