Summary
When deploying GenU from an EC2 instance or a local environment (not CloudShell), the deployment fails if TypeScript 5.9 or later is installed. This is caused by breaking changes introduced in TypeScript 5.9 related to variable scoping and the updated decorator implementation. GenU’s CDK project does not currently restrict the TypeScript version, which results in npm installing or using the latest version and causing deployment failures.
CloudShell does not exhibit this issue because it uses an older TypeScript version (5.8.x), which remains compatible with the current GenU CDK code.
Steps to Reproduce
- Prepare a clean EC2 (Amazon Linux 2023) or local Linux/macOS environment.
- Install Node.js and TypeScript (latest version, 5.9+).
- Clone the GenU repository.
- Run:
- Deploy using:
Expected Behavior
The CDK deployment should complete successfully.
Actual Behavior
The deployment fails with TypeScript compilation errors, such as:
- TS18028: 'using' declarations are not allowed when the 'using' flag is not enabled
- TS1241: Unable to resolve signature of method decorator
- TS1479: Decorators cannot be used with this TypeScript configuration
These errors do not occur when using TypeScript 5.8.x.
Root Cause (Analysis)
- TypeScript 5.9 introduced breaking changes related to:
using / await using declarations
- Standardized decorators
- Changes in variable scoping rules
- AWS CDK (v2.x) is not yet fully compatible with TypeScript 5.9+.
- GenU’s
package.json pins TypeScript to ~5.4.5, but CDK may still resolve to a globally installed TypeScript version (5.9+) depending on environment configuration.
Workaround
Install TypeScript 5.8.x manually:
npm install -g typescript@5.8
or locally:
npm install --save-dev typescript@5.8
Suggested Fix
Explicitly pin TypeScript to a compatible version in package.json, for example:
"devDependencies": {
"typescript": "5.8.x"
}
or add an engine constraint:
"engines": {
"typescript": "5.8.x"
}
Additional Notes
This issue affects:
- EC2 deployments
- Local deployments (Linux/macOS/Windows)
- Any environment where TypeScript 5.9+ is installed globally
CloudShell is unaffected because it uses TypeScript 5.8.x by default.
Thank you for reviewing this issue.
Summary
When deploying GenU from an EC2 instance or a local environment (not CloudShell), the deployment fails if TypeScript 5.9 or later is installed. This is caused by breaking changes introduced in TypeScript 5.9 related to variable scoping and the updated decorator implementation. GenU’s CDK project does not currently restrict the TypeScript version, which results in npm installing or using the latest version and causing deployment failures.
CloudShell does not exhibit this issue because it uses an older TypeScript version (5.8.x), which remains compatible with the current GenU CDK code.
Steps to Reproduce
Expected Behavior
The CDK deployment should complete successfully.
Actual Behavior
The deployment fails with TypeScript compilation errors, such as:
These errors do not occur when using TypeScript 5.8.x.
Root Cause (Analysis)
using/await usingdeclarationspackage.jsonpins TypeScript to~5.4.5, but CDK may still resolve to a globally installed TypeScript version (5.9+) depending on environment configuration.Workaround
Install TypeScript 5.8.x manually:
or locally:
Suggested Fix
Explicitly pin TypeScript to a compatible version in
package.json, for example:or add an engine constraint:
Additional Notes
This issue affects:
CloudShell is unaffected because it uses TypeScript 5.8.x by default.
Thank you for reviewing this issue.