Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

‼️ (python): NameError: name 'SubnetSelection' is not defined #21790

Closed
anggras opened this issue Aug 27, 2022 · 4 comments
Closed

‼️ (python): NameError: name 'SubnetSelection' is not defined #21790

anggras opened this issue Aug 27, 2022 · 4 comments
Assignees
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. language/python Related to Python bindings management/tracking Issues that track a subject or multiple issues p0

Comments

@anggras
Copy link

anggras commented Aug 27, 2022

Please add your +1 👍 to let us know you have encountered this

Status: Fixed in CDK v2.39.1 and v1.170.1

Overview:

CDK Python applications throw a NameError error on synthesis indicating that a name is 'not defined'.

For example when trying to use SubnetSelection

lb = elbv2.ApplicationLoadBalancer(
            self, "MainLB",
            vpc=vpc,
            vpc_subnets={
                'subnet_group_name': "Ingress"
            },
            internet_facing=True
        )

Will throw the error NameError: name 'SubnetSelection' is not defined

Complete Error Message:

Traceback (most recent call last):
  File "/tmp/cdk-tmp-python/app.py", line 10, in <module>
    CdkTmpPythonStack(app, "CdkTmpPythonStack",
  File "/tmp/cdk-tmp-python/.venv/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/tmp/cdk-tmp-python/cdk_tmp_python/cdk_tmp_python_stack.py", line 24, in __init__
    lb = elbv2.ApplicationLoadBalancer(
  File "/tmp/cdk-tmp-python/.venv/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/tmp/cdk-tmp-python/.venv/lib/python3.9/site-packages/aws_cdk/aws_elasticloadbalancingv2/__init__.py", line 16381, in __init__
    props = ApplicationLoadBalancerProps(
  File "/tmp/cdk-tmp-python/.venv/lib/python3.9/site-packages/aws_cdk/aws_elasticloadbalancingv2/__init__.py", line 15357, in __init__
    vpc_subnets = SubnetSelection(**vpc_subnets)
NameError: name 'SubnetSelection' is not defined

Workaround:

Currently the only workaround is to stay on v2.38.1

Solution:

Related Issues:

Framework Version

2.39.0

Language

Python

@anggras anggras added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 27, 2022
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Aug 27, 2022
@corymhall corymhall added p0 language/python Related to Python bindings and removed needs-triage This issue or PR still needs to be triaged. labels Aug 29, 2022
@corymhall corymhall changed the title aws_ec2: NameError: name 'SubnetSelection' is not defined ‼️ (python): NameError: name 'SubnetSelection' is not defined Aug 29, 2022
@corymhall corymhall added the management/tracking Issues that track a subject or multiple issues label Aug 29, 2022
@corymhall corymhall pinned this issue Aug 29, 2022
@corymhall
Copy link
Contributor

@anggras thanks for reporting this issue! We've labeled this as a p0 and have identified a fix in JSII. We will update this ticket once the fix has been released.

mergify bot pushed a commit that referenced this issue Aug 29, 2022
Ran npm-check-updates and yarn upgrade to keep the `yarn.lock` file up-to-date.

This applies a fix for a [p0](#21790). Fix is applied from jsii-pacmak@1.65.1.
ryparker pushed a commit that referenced this issue Aug 29, 2022
Ran npm-check-updates and yarn upgrade to keep the `yarn.lock` file up-to-date.

This applies a fix for a [p0](#21790). Fix is applied from jsii-pacmak@1.65.1.
@ryparker
Copy link
Contributor

ryparker commented Aug 30, 2022

Fix has been released in CDK v2.39.1.

josephedward pushed a commit to josephedward/aws-cdk that referenced this issue Aug 30, 2022
Ran npm-check-updates and yarn upgrade to keep the `yarn.lock` file up-to-date.

This applies a fix for a [p0](aws#21790). Fix is applied from jsii-pacmak@1.65.1.
ryparker pushed a commit that referenced this issue Aug 30, 2022
Ran npm-check-updates and yarn upgrade to keep the `yarn.lock` file up-to-date.

This applies a fix for a [p0](#21790). Fix is applied from jsii-pacmak@1.65.1.
# Conflicts:
#	packages/@aws-cdk/aws-eks/package.json
#	yarn.lock
@ryparker
Copy link
Contributor

Fix has been released for v1 CDK in 1.170.1

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

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.

@rix0rrr rix0rrr unpinned this issue Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. language/python Related to Python bindings management/tracking Issues that track a subject or multiple issues p0
Projects
None yet
Development

No branches or pull requests

4 participants