I am somewhat new to AWS, and trying to build my portfolio. I am in the process of building a 3-tier web application, the architecture is simple: a static website hosted on an S3 bucket located behind a CloudFront distribution is my web tier, then we have an API Gateway that the web-tier use to connect to the application tier, the API Gateway is connected to my VPC, where the application tier resides via a VPC link, which forwards the requests to a network load balancer, which in turn forwards the request to the EC2 instances in an ASG. My problem is that whenever I deploy my resource, and I am using CloudFormation for re-deploying the resources until I get it to work, whenever I deploy the resource, and try to call an API, I am getting this error:
{"error": "Unexpected exception", "message": "'NoneType' object has no attribute 'listeners'", "type": "AttributeError"}
I have used everything to make sure the NLB is configured correctly, the listener is available and the target group are available, and the EC2 instances are running with port 80 running open and listening for requests, the security groups are also configured to allow inbound traffic needed for successful communication.
I have no python scripts on my stack, I have used a simple PHP script on my EC2 instances to test the flow. But actually I am using LocalStack for local development, I didn't try to deploy my cfn stack on a real AWS environment, so maybe that is what is causing the error ?
I'm not familiar with your local environment, but yes, it'd be entirely feasible that the LocalStack environment isn't able to simulate one of the AWS components, like the NLB that would have one or more "listeners" mentioned in the error message.