Python jsii: trying to serialize a function (after forgetting to call it) yields a very obscure error message #4064
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
bug
This issue is a bug.
language/python
Related to Python bindings
🐛 Bug Report
What is the problem?
I'm using the AWS CDK with Python. I'm trying to add an Ingress Rule to a VPC SecurityGroup using the add_ingress_rule() method within the aws_ec2.SecurityGroup construct. The method signature is as described in the API documentation here
However, when I run
cdk deploy
the following error is thrown :AttributeError: 'method' object has no attribute '__jsii__type__'
It seems CDK doesn't like the
connection = ec2.Port.tcp(443)
parameter.Reproduction Steps
Simple Code as below -
`
#!/usr/bin/env python3
`
Verbose Log
$ cdk deploy cdk-scratch --profile blaze-projects Traceback (most recent call last): File "app.py", line 54, in <module> NetworkStack(app, "cdk-scratch", env=my_env) File "D:\blazeclan-git-repo\aws-cdk-stuff\cdk-scratch\.env\lib\site-packages\jsii\_runtime.py", line 66, in __call__ inst = super().__call__(*args, **kwargs) File "app.py", line 50, in __init__ connection = ec2.Port.tcp(443) File "D:\blazeclan-git-repo\aws-cdk-stuff\cdk-scratch\.env\lib\site-packages\aws_cdk\aws_ec2\__init__.py", line 19275, in add_ingress_rule return jsii.invoke(self, "addIngressRule", [peer, connection, description, remote_rule]) File "D:\blazeclan-git-repo\aws-cdk-stuff\cdk-scratch\.env\lib\site-packages\jsii\_kernel\__init__.py", line 104, in wrapped return _recursize_dereference(kernel, fn(kernel, *args, **kwargs)) File "D:\blazeclan-git-repo\aws-cdk-stuff\cdk-scratch\.env\lib\site-packages\jsii\_kernel\__init__.py", line 267, in invoke args=_make_reference_for_native(self, args), File "D:\blazeclan-git-repo\aws-cdk-stuff\cdk-scratch\.env\lib\site-packages\jsii\_kernel\__init__.py", line 119, in _make_reference_for_native return [_make_reference_for_native(kernel, i) for i in d] File "D:\blazeclan-git-repo\aws-cdk-stuff\cdk-scratch\.env\lib\site-packages\jsii\_kernel\__init__.py", line 119, in <listcomp> return [_make_reference_for_native(kernel, i) for i in d] File "D:\blazeclan-git-repo\aws-cdk-stuff\cdk-scratch\.env\lib\site-packages\jsii\_kernel\__init__.py", line 130, in _make_reference_for_native d.__jsii__type__ = "Object" AttributeError: 'method' object has no attribute '__jsii__type__' Subprocess exited with error 1 (.env)
Environment
1.8.0 (build 5244f97)
aws-cdk.aws-ec2
Version1.8.0
Windows 10
Python 3.7.2
Other information
The text was updated successfully, but these errors were encountered: