@aws-sdk/client-s3 makes node_modules too large
See original GitHub issueDescribe the bug
When @aws-sdk/client-s3
@3.29.0 is installed, it downloads aws-crt
as a dependency which is about 200MB in size. It occupies about 60MB even when we compress it.
My team updates the lambda function by directly zipping the directory and uploading it, but we can’t do it anymore because we hit the size limit of the allowed archive size.
The problem is gone after we downgrade @aws-sdk/client-s3
to 3.28.0, but we’d like to use the most recent version if possible.
Your environment
SDK version number
@aws-sdk/client-s3@3.29.0
Is the issue in the browser/Node.js/ReactNative?
Node.js
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How we halved the publish size of modular AWS SDK for ...
For example, installing @aws-sdk/client-sts@3.33.0 creates a node_modules with size of 8.9 MB. The client-sts is of size 1.4 MB and contains 115 ...
Read more >Nodejs modularized aws-sdk v3 size getting increased
1 Answer 1 · Don't push aws-sdk to the lambda function. · Lambda will provide all necessary SDK modules(v2 & v3) during runtime,...
Read more >Cleanup the node_modules for a lighter Lambda Function
Any nodejs project carries a bulky folder - the node_modules - that carries all the modules and dependencies that the application would need. ......
Read more >aws-sdk/client-s3
AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native. Latest version: 3.238.0, last published: 3 days ago.
Read more >How to migrate your Node.js Lambda functions to AWS ...
You only require (or import ) the module for the specific service client you need, rather than importing the entire aws-sdk module.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In addition since aws-crt includes a native blob which does not support alpine, it fails for example on node:16.8.0-alpine.
After bundling using
esbuild
and deploying to Lambda we are getting the following errors: