-
Notifications
You must be signed in to change notification settings - Fork 247
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
Lazy still broken in Python #1781
Comments
Ah, so perhaps this is an AWS CDK issue: The example at https://docs.aws.amazon.com/cdk/latest/guide/tokens.html (with Python selected) fails as written, but if you use the example from #807 and add @jsii.implements(core.IStringProducer) as an annotation to the producing class, it succeeds with the workaround. |
This issue has not received any attention in 2 years. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
This seems stil an issue. Can you reopen this bug? |
I found a workaround for this bug. The following allows for synth time creation of any constructs with a callback:
|
🐛 Bug Report
The following fails on CDK 1.49.1:
class Foo:
def produce(me, context):
return self.api.rest_api_id
lazy = core.Lazy.string_value(Foo())
with the error: AttributeError: type object 'Foo' has no attribute 'jsii_type'
Possibly recurrence or variant of 807 (#807)
Affected Languages
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)General Information
What is the problem?
Lazy in AWS CDK Python appears to have a jsii serialization problem; see discussion in 807.
Verbose Log
Traceback (most recent call last):
File "deploy.py", line 80, in
deployer.deploy()
File "deploy.py", line 63, in deploy
cdk = cdkstack.CdkStack(scope=app, id='VendiaShareDeployer',
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/jsii/_runtime.py", line 66, in call
inst = super().call(*args, **kwargs)
File "/Users/timwagner/Desktop/projects/vendia/src/share/server/deploy/cdkstack.py", line 32, in init
lazy = core.Lazy.string_value(Foo())
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/aws_cdk/core/init.py", line 6313, in string_value
return jsii.sinvoke(cls, "stringValue", [producer, options])
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/jsii/_kernel/init.py", line 113, in wrapped
return _recursize_dereference(kernel, fn(kernel, *args, **kwargs))
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/jsii/_kernel/init.py", line 311, in sinvoke
args=_make_reference_for_native(self, args),
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/jsii/_kernel/init.py", line 124, in _make_reference_for_native
return [_make_reference_for_native(kernel, i) for i in d]
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/jsii/_kernel/init.py", line 124, in
return [_make_reference_for_native(kernel, i) for i in d]
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/jsii/_kernel/init.py", line 151, in _make_reference_for_native
kernel.create(d.class, d)
File "/Users/timwagner/Desktop/projects/vendia/src/share/venv/lib/python3.8/site-packages/jsii/_kernel/init.py", line 226, in create
fqn=klass.jsii_type or "Object",
AttributeError: type object 'Foo' has no attribute 'jsii_type'
The text was updated successfully, but these errors were encountered: