Acessing the 'DistributionConfig' of the 'CfnDistribution_' throws an error
See original GitHub issueNote: for support questions, please first reference our documentation, then use Stackoverflow. This repository’s issues are intended for feature requests and bug reports.
-
I’m submitting a …
- 🪲 bug report
- 🚀 feature request
- 📚 construct library gap
- ☎️ security issue or vulnerability => Please see policy
- ❓ support request => Please see note at the top of this template.
-
What is the current behavior? If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce
Create a new CloudFrontWebDistribution
, var cf = new CloudFrontWebDistribution
Access the underlying CfnDistribution_
with var cfd = cf.Node.FindChild("CFDistribution") as CfnDistribution_;
Acessing the DistributionConfig
of the CfnDistribution_
throws an error:
Got 'undefined' for non-optional instance of {"abstract":true,"docs":{"remarks":"If this returns an empty array the stack will not be attached.","stability":"stable","summary":"The creation stack of this resolvable which will be appended to errors thrown during resolution."},"immutable":true,"locationInModule":{"filename":"lib/resolvable.ts","line":38},"name":"creationStack","type":{"collection":{"elementtype":{"primitive":"string"},"kind":"array"}}}
- What is the expected behavior (or behavior of feature suggested)?
To be able to see the DistributionConfig
of the CfnDistribution_
- What is the motivation / use case for changing the behavior or adding this feature?
I was trying to work around other bugs in the CloudFrontWebDistribution
by accessing the DistributionConfig
to modify and add it back as overrides
-
Please tell us about your environment:
- CDK CLI Version: 0.39
- Module Version: 0.39
- OS: [Windows 10]
- Language: [C#]
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc) Stacktrace:
Got 'undefined' for non-optional instance of {"abstract":true,"docs":{"remarks":"If this returns an empty array the stack will not be attached.","stability":"stable","summary":"The creation stack of this resolvable which will be appended to errors thrown during resolution."},"immutable":true,"locationInModule":{"filename":"lib/resolvable.ts","line":38},"name":"creationStack","type":{"collection":{"elementtype":{"primitive":"string"},"kind":"array"}}}
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Deputy.DeputyBase.GetPropertyCore[T](JsiiPropertyAttribute propertyAttribute, Func`2 getFunc)
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (21 by maintainers)
Top GitHub Comments
I tried it with CDK 1.70 and JSII 1.14, but I got the following error running the repro stack above:
System.InvalidCastException: 'Unable to cast Amazon.JSII.Runtime.Deputy.AnonymousObject into Amazon.CDK.AWS.CloudFront.CfnDistribution+DistributionConfigProperty'
I verified; just reproduced the above errors (
Amazon.JSII.Runtime.Deputy.AnonymousObject
/NPE) on CDK 1.68.0.