redis createclient giving error "SocketClosedUnexpectedlyError" while connecting to elasticache redis

0

I have below code setup which is resulting in pubClient getting connected successfully and then giving error message: pubClient SocketClosedUnexpectedlyError: Socket closed unexpectedly at Socket.<anonymous> (/var/app/current/node_modules/@redis/client/dist/lib/client/socket.js:194:118) at Object.onceWrapper (node:events:629:26) at Socket.emit (node:events:514:28) at TCP.<anonymous> (node:net:337:12).

my code is as below: let pubClient, subClient; try { pubClient = createClient({ socket: { host: '<elasticache-redis-endpoint>', port: <port number> } }); subClient = pubClient.duplicate();

} catch (error) { console.error('Failed to create Redis clients:', error); }

Promise.all([pubClient.connect(), subClient.connect()]).then(() => { io.adapter(createAdapter(pubClient, subClient)); io.listen(5003); });

  • Hi, Its seems that you successfully create the client, but its fail to connect. Your code is failing on /var/app/current/node_modules/@redis/client/dist/lib/client/socket.js:194:118 which is part of the socket connection. Its hard to say from the info shared what could be the problem, can you please share a bit more info? maybe try to add error logging to the connection. Please check that your configuration are right, as access from your app to your Elasticache.

feita há um mês103 visualizações
1 Resposta
0

Hello!

Errors with Elasticache Redis during the connection establishment process such as SocketClosedUnexpectedlyError are typically due to some sort of configuration issue occurring when attempting to connect to the cluster. This includes situations such as:

I would first recommend making sure you can establish a connection to the cluster from the instance/machine that your application/client is running in (see this guide for instructions on how to perform this https://repost.aws/knowledge-center/elasticache-connection-test).

Should you require further assistance with this, please create an AWS support case with additional details such as the cluster ID and timestamp (in UTC format) of when the connection attempt was made to get in touch with an available engineer.

https://docs.aws.amazon.com/awssupport/latest/user/case-management.html

AWS
ENGENHEIRO DE SUPORTE
Juan_P
respondido há um mês

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas