aws / aws/aws-cdk

elasticloadbalancingv2: elvb2.HealthCheck requires ecs.Protocol instead of elbv2.Protocol

Open
#22,689 4 comments 3 reactions 0 assignees View on GitHub
@aws-cdk/aws-elasticloadbalancingv2 bug p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the bug

In CDK 2.48.0+, typeguard in Python is requiring that the `Protocol` parameter of elasticloadbalancingv2.HealthCheck is of type `ecs.Protocol`, not `elasticloadbalancingv2.Protocol` as it was in CDK 2.47.0 and older.

### Expected Behavior

elasticloadbalancingv2.HealthCheck should require elasticloadbalancingv2.Protocol, not ecs.Protocol

The following Python code should be valid:

```
elbv2.ApplicationTargetGroup(
scope= self,
id= "webserverTargetGroup",
port= 80,
target_type= elbv2.TargetType.IP,
vpc= myVpc,
health_check= elbv2.HealthCheck(
protocol= elbv2.Protocol.HTTP,
healthy_threshold_count= 2,
unhealthy_threshold_count= 4
)
)
```

### Current Behavior

The above code results in the following error during synthesis:

```
TypeError: type of argument protocol must be one of (aws_cdk.aws_ecs.Protocol, NoneType); got aws_cdk.aws_elasticloadbalancingv2.Protocol instead
```

### Reproduction Steps

See "Expected Behavior" above

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.48.0 and 2.49.0

### Framework Version

2.48.0 and 2.49.0

### Node.js Version

v18.12.0

### OS

macOS 12.6

### Language

Python

### Language Version

Python 3.10.8

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running the Python reproduction from the issue with CDK 2.48.0 or 2.49.0, then inspect the elasticloadbalancingv2.HealthCheck and Protocol type declarations involved in the error. Done means the example synthesizes without the reported TypeError and accepts elasticloadbalancingv2.Protocol as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.