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: jsii throwing error on Python list after recent CDK update #16039

Closed
1 of 5 tasks
whoami-defnotme opened this issue Aug 1, 2021 · 3 comments · Fixed by #16040
Closed
1 of 5 tasks

Python: jsii throwing error on Python list after recent CDK update #16039

whoami-defnotme opened this issue Aug 1, 2021 · 3 comments · Fixed by #16040
Assignees

Comments

@whoami-defnotme
Copy link

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)
  • Go

General Information

  • JSII Version: 1.29.0 (from python3 -m pip show jsii)
  • Platform: macOS 11.5.1

Problem

After a relatively recent CDK fix to finally allow an easy method for using static IP addresses (#14250), I get an error in jsii while trying to run cdk synth on my Python stack. The exception thrown is:

jsii.errors.JSIIError: Cannot get element 1 from eipalloc-AAAAAAAA

My Python stack snippet is as follows:

        nat_gateway_provider = ec2.NatProvider.gateway(
            eip_allocation_ids = ["eipalloc-AAAAAAAA"]
        )

        vpc = ec2.Vpc(
            self, "idVPC", 
            nat_gateway_provider = nat_gateway_provider
        )

The TypeScript test committed with the PR shows eip_allocation_ids should be a sequence (or Python list). The Python docs suggest the same.

It seems jsii is not handling this correctly.

@RomainMuller
Copy link
Contributor

Hey!

This is in fact not a jsii bug... The issue you're having is that the NatProvider.gateway list of EIP allocation IDs needs to have 1 element per subnet your VPC has (by default 2 or 3). CDK does not format the error message correctly (or more appropriately, the toString() of an array containing a single string is VERY surprising).

@RomainMuller RomainMuller transferred this issue from aws/jsii Aug 13, 2021
RomainMuller added a commit that referenced this issue Aug 13, 2021
When manually configuring NAT gateways for a VPC, a relatively opaque
error is emitted when insufficient EIP allocation IDs are provided,
compared to the subnet count.

Added a proactive validation of the allocation IDs to improve the
actionability of the error message.

Fixes #16039
@mergify mergify bot closed this as completed in #16040 Aug 13, 2021
mergify bot pushed a commit that referenced this issue Aug 13, 2021
)

When manually configuring NAT gateways for a VPC, a relatively opaque
error is emitted when insufficient EIP allocation IDs are provided,
compared to the subnet count.

Added a proactive validation of the allocation IDs to improve the
actionability of the error message.

Fixes #16039


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@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.

@whoami-defnotme
Copy link
Author

@RomainMuller - thanks for figuring this out! It's been the bane of my existence for quite some time now. Looking forward to updating and testing.

hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
…#16040)

When manually configuring NAT gateways for a VPC, a relatively opaque
error is emitted when insufficient EIP allocation IDs are provided,
compared to the subnet count.

Added a proactive validation of the allocation IDs to improve the
actionability of the error message.

Fixes aws#16039


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Sep 6, 2021
…#16040)

When manually configuring NAT gateways for a VPC, a relatively opaque
error is emitted when insufficient EIP allocation IDs are provided,
compared to the subnet count.

Added a proactive validation of the allocation IDs to improve the
actionability of the error message.

Fixes aws#16039


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this issue Sep 7, 2021
…#16040)

When manually configuring NAT gateways for a VPC, a relatively opaque
error is emitted when insufficient EIP allocation IDs are provided,
compared to the subnet count.

Added a proactive validation of the allocation IDs to improve the
actionability of the error message.

Fixes aws#16039


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants