redissocket.ioamazon-ecsaws-fargateamazon-elasticache

Error Code 137 while using Elasticache Redis with ECS Fargate


I am running containers on ECS Fargate and everything is working as expected but there is one issue. When I have this redis code running in my server side, the server container is failing to reach a steady state and failing.

And when I expand the api container its showing Error Code 137

const REDIS_ENDPOINT = process.env.REDIS_ENDPOINT;

const pubClient = createClient({
  url: REDIS_ENDPOINT,
});

const subClient = pubClient.duplicate();

await Promise.all([pubClient.connect(), subClient.connect()]);

Plus there are no logs given by the server container in my cloudwatch. All other containers are working as expected such as client, nginx, mongo and redis.

Really need some help here. I am pulling my hair out as I am typing this.


Solution

  • I was using Elasticache Redis serverless and found out that it does not support pub sub capability.

    You have to create your own cluster and everything will work fine.