jsii icon indicating copy to clipboard operation
jsii copied to clipboard

AWS Javascript SDK v3 does not work with jsii due to Typescript <4 dependency

Open markusl opened this issue 5 years ago • 5 comments

:bug: Bug Report

It seems that jsii-rosetta has a dependency on Typescript 3.9.7: https://github.com/aws/jsii/blob/main/packages/jsii-rosetta/package.json#L37

This causes AWS JS SDK v3 to not work with Lambda packaging due to their issue https://github.com/aws/aws-sdk-js-v3/issues/1919

Affected Languages

  • [x] TypeScript or Javascript
  • [ ] Python
  • [ ] Java
  • [ ] .NET (C#, F#, ...)

General Information

  • JSII Version: 1.17.1
  • Platform: macOS / Github

What is the problem?

Cannot use jsii to package an AWS Lambda function in AWS CDK that refers to Lambda code that uses AWS JS SDK v3.

Verbose Log

See logs at https://github.com/markusl/cdk-ecr-image-scan-handler/runs/1710191168

node_modules/@aws-sdk/types/dist/cjs/util.d.ts:92:42 - error TS1005: ',' expected.

92 export declare type UserAgentPair = [name: string, version?: string];

markusl avatar Jan 15 '21 17:01 markusl

Unfortunately the presence of breaking changes in TS 4.0+ makes it difficult for us to upgrade without releasing a new major version... We have considered making TypeScript a peer dependency of jsii (but this would also be a breaking change) -- however the compiler API changes between releases would make this impossible, too...

RomainMuller avatar Feb 16 '21 12:02 RomainMuller

I'm also having this issue, altough with another bundled dependency ( ajv). While I see that this is a breaking change, this will just grow to be a bigger over time with more and more typescript 4 out there. Do you have any rough plans on when you want to release a new major version which would then also upgrade to typescript 4?

webratz avatar Nov 18 '21 08:11 webratz

I ran into this issue today with ajv and chalk as bundled dependencies

austindimmer avatar Oct 25 '22 09:10 austindimmer

This would be addressed when we implement https://github.com/aws/aws-cdk-rfcs/pull/373, which we are currently planning.

RomainMuller avatar Nov 15 '22 10:11 RomainMuller