Closed tuipopenoe closed 2 years ago
@tuipopenoe I haven't been able to reproduce this on a new project. I've tried both creating a load balancer with the listener and creating the load balancer first and then creating the listener and I was able to create successfully. Is there anything else in your app?
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Setup a brand new stack and was unable to replicate, ALB was created successfully. Closing this as no issue.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
The issue was we were using an ApplicationLoadBalancedFargateService (https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ApplicationLoadBalancedFargateService.html) that creates a PublicListener on port 80 by default. Accessing the listener to change the TargetGroup causes an error, so in the end we switched to manually creating an ALB and attaching it to a FargateService, resolving this error.
I encountered the same problem as tuipopenoe and I solved it by temporarily not using redirectHTTP: true
.
After deploying it, I added redirectHTTP: true
back again.
Describe the bug
Creating an ApplicationLoadBalancer and then adding an ApplicationListener as described in the documentation fails as instantiating a new
ApplicationLoadBalancer
creates a default ApplicationListener on port 80https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html
This makes it impossible to add an ASG as a target of the listener, as the default created ApplicationListener is not accessible in
What is the expected method to add an ASG as a target of the default listener, or override the default listener with a new listener on port 80?
Expected Behavior
ApplicationLoadBalancer to be created, and then able to add an ApplicationListener on port 80.
Current Behavior
Exception occurs during deployment, stating that a listener already exists on port 80 and cannot be added. ApplicationLoadBalancer creates a default ApplicationListener on port 80, that cannot have targets added to it.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.27.0 (build 8e89048)
Framework Version
No response
Node.js Version
v18.3.0
OS
Mac OS 12.4
Language
Typescript
Language Version
No response
Other information
No response