Search code examples
reactjsamazon-web-servicescontainersamazon-ecsaws-fargate

React app SPA white screen Fargate, healthy checks on task instances


I have a React SPA hosted on AWS Fargate. When I tested the SPA locally, all tests passed. I deployed the app last month to Fargate and no issues. As late as last week, everything was normal.

Then yesterday, the URL is a white screen. The task instances are evaluated as healthy on the health checks and three are running. So I am at a loss for how two things could be possible

  1. Task instances (containers) are running
  2. Task instances are healthy
  3. React app unresponsive

How is it that the app could fail but this would not bubble up the health checks?


Solution

  • The issue that you described (site can't be reached) implies that routing is a potential issue.

    Trace the traffic to the service

    If you are using a load balancer to control traffic to your ECS tasks in Fargate, was the route, LB, or Target Group changed at all? Check...

    • The target of the record in Route53
    • The listener on the load balancer (has the port, routing rules, or target group changed?)
    • The target group that the listener points to, does it show healthy? Is it cycling containers?
    • The containers themselves... do they still listen on the same ports (and is that consistent with the target group configuration)

    If you are using the public IP of the task to route to... don't do that. Each time the task restarts, it'll get a new public IP. Use a load balancer.

    Security

    Double check:

    • NACLs: have they been updated? Do they still allow traffic on the subnets/ports/etc. that you need?
    • Security Groups: have they been updated? Do they still allow traffic incoming traffic on the ports you require (ie. 80/443) and are they still associated with your ECS Service?

    That's typically the checklist I go through when encountering such an issue.