Aws-sdk-js: Too much memory used for typescript compilation

Created on 6 Jan 2020  路  8Comments  路  Source: aws/aws-sdk-js

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
Too much memory used for typescript compilation. Duplicate of https://github.com/aws/aws-sdk-js/issues/2846.

Bringing this up again since I think it is a serious enough problem that we can't compile even the hello world of the SDK in a EC2 linux t3.micro machine. Running it with --max-old-space-size=4096 and 1 GB swap works, but I don't think it should take so much memory to compile just this small program.

Is the issue in the browser/Node.js?
Node.js

If on Node.js, are you running this on AWS Lambda?
No

Details of the browser/Node.js version
v12.13.0

SDK version number
Example: 2.597.0

To Reproduce (observed behavior)
Just trying to compile this one line TS file results in a out of memory error on a t3.micro AWS instance with nothing else running on it!

import  CloudFront from "aws-sdk/clients/cloudfront";

Expected behavior
I wanted the program to compile

Screenshots

Additional context

duplicate feature-request needs-major-version

Most helpful comment

@trivikr thanks!
I had a unused devdependency of aws-sdk which was making tsc eat all my ram!

All 8 comments

Hey @inian thank-you for reaching out to us with your issue.

As mentioned before in my comment in #2846 this would need a major-version in order to make it the importation more modular. Right now it imports around 200 files when using import aws-sdk which increases the memory usage. The JS-SDK-V3 will be able to address this problem which is under developer preview right now.

Since it is not necessarily a bug with the SDK I will mark it as a feature-request for now.

Any idea when the JS-SDK-V3 would be GA?

@inian the beta is out now. It's hard to estimate the GA yet.

@inian you could get a better performance compiling with --skipLibCheck
It is not, the best solution, but I think the only one, till a stable version

the source is here : https://swatinem.de/blog/optimizing-tsc/

even with the skipLibCheck tag activated, the memory overhead is ~300Mo

it should be considered as a bug IMO: we have a 5-10 microservices using aws-sdk, and opening the repo with those microservices literally freezes any IDE using tsserver

it's not only a matter of deployment, but also developer experience

we are currently testing v3, but it still lacks documentation, so it's a bit tricky :)

Cheers

even with the skipLibCheck tag activated, the memory overhead is ~300Mo

it should be considered as a bug IMO: we have a 5-10 microservices using aws-sdk, and opening the repo with those microservices literally freezes any IDE using tsserver

it's not only a matter of deployment, but also developer experience

we are currently testing v3, but it still lacks documentation, so it's a bit tricky :)

Cheers

yes. I have the same problem. A tiny app, but when I added the aws-sdk the ec2 never compile, and consume all my credits

Verified that this issue is fixed in [email protected] by updating dependency in repro repo https://github.com/JakeGinnivan/aws-sdk-deep-imports

@trivikr thanks!
I had a unused devdependency of aws-sdk which was making tsc eat all my ram!

Was this page helpful?
0 / 5 - 0 ratings