ECS Fargate and ALB failed the health check with timeout (Node.js app)

0

I have been trying for two days to run a Node.js application on ECS Fargate connected to a Load Balancer, but somehow it does not pass the health check.

I use CDK to create the infrastructure and already use other applications with the same setup that work perfectly.

The Dockerfile image works perfectly locally with docker-compose.

I am not convinced that's a problem at the SG and infrastructure level, but I think more that it's application side, maybe you have an idea where to go to check.

The application is not developed by me and uses Express as server with listener on port 9000.

IMPORTANT: I created a small application to test with the same port and endpoint for heath check = it worked perfectly. (health check passed)

I increased the ECS idle timeout etc. but nothing

Looking at the Task Logs (see image), I see that the application returns a 200 status on the heath check endpoint, however if I try to call the load balancer from its address, the call goes to 504 timeout.

I tried from an EC2 machine to connect to the task on the private IP-address: with telnet it seems to work, but if I curl on the health check endpoint, it goes to timeouts.

Sometimes if I try to call the load balancer several times (perhaps while the task is starting), the application responds (i.e. I see that the endpoint is working), but immediately afterwards it goes into timeout

Any idea?

Enter image description here

1 Answer
0

Are you using IPv6? If so, I am wondering if IPv6 CIDR block is allowed in your security group.

Sorry if this is the wrong consideration.

y
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions