You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In TS, templates that pass numbers where strings are expected causes a type error. This is arguably the right behavior, since the types don't match, but CFN allows passing 1 where '1' is expected.
The emitted Java code includes string literals that aren't properly escaped, or possibly just missing terminating / opening quotes. Not sure which.
CSharp does not like multi-line strings.
Go and Python are failing with type errors that are not obvious.
Unclear if the number-to-string coalescing is the root cause of this for all languages, or if something else is happening.
Reproduction Steps
Copy the JSON template at the end of this report
Create a new end-to-end test that uses that template
Type 'number' is not assignable to type 'string'.ts(2322)
This is caused by this code:
public constructor(scope: cdk.App, id: string, props: EfsStackProps = {}) {
super(scope, id, props);
// Applying default props
props = {
...props,
// ...
asgMaxSize: props.asgMaxSize ?? 2, // Type 'number' is not assignable to type 'string'.ts(2322)
};
This is happening because in the JSON, we have:
"AsgMaxSize": {
"Type": "Number",
"Description": "Maximum size and initial desired capacity of Auto Scaling Group",
"Default": "2"
},
This is passed here:
"AutoScalingGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"MinSize": "1",
"MaxSize": { "Ref": "AsgMaxSize" }, // MaxSize is a string property
It's debatable whether this is really a bug. cdk-from-cfn is doing the right thing, this only works because CFN allows you to pass a string where a number is expected.
This is a modified form of this sample template. It is identical, except I've removed the SSH KeyPair, because it's a resource that this template expects to exist and that makes this harder to reproduce.
Summary
In TS, templates that pass numbers where strings are expected causes a type error. This is arguably the right behavior, since the types don't match, but CFN allows passing
1
where'1'
is expected.The emitted Java code includes string literals that aren't properly escaped, or possibly just missing terminating / opening quotes. Not sure which.
CSharp does not like multi-line strings.
Go and Python are failing with type errors that are not obvious.
Unclear if the number-to-string coalescing is the root cause of this for all languages, or if something else is happening.
Reproduction Steps
unset CREATE_CFN_STACK
cargo test --test end-to-end efs -- --nocapture
TypeScript
Fails with
This is caused by this code:
This is happening because in the JSON, we have:
This is passed here:
It's debatable whether this is really a bug.
cdk-from-cfn
is doing the right thing, this only works because CFN allows you to pass a string where a number is expected.Java
Fails with unenclosed string literals:
The errors are visible with syntax highlighting starting near line 254:
Python
Fails with:
No idea what causes this. It's trying to index a dictionary with an unresolved Token.
CSharp
Doesn't like newlines appearing in string literals:
Caused by:
Go
Fails with
It's mad about this code:
Full JSON template
This is a modified form of this sample template. It is identical, except I've removed the SSH KeyPair, because it's a resource that this template expects to exist and that makes this harder to reproduce.
The text was updated successfully, but these errors were encountered: