Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: reduce npm_modules size #419

Closed
saragerion opened this issue Jan 6, 2022 · 7 comments · Fixed by #427
Closed

Feature request: reduce npm_modules size #419

saragerion opened this issue Jan 6, 2022 · 7 comments · Fixed by #427
Assignees
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility logger This item relates to the Logger Utility

Comments

@saragerion
Copy link
Contributor

saragerion commented Jan 6, 2022

Bug description

The current bundle size of the Logger library is unnecessarily big. This has an impact on the performance of the Lambda functions (cold starts included).

Expected Behavior

The node_modules folder has a reasonable size.

Current Behavior

The node_modules folder is 139M.

Possible Solution

One of the biggest reasons is the lodash library that is currently a prod dependency, which is unnecessary.
It would also be good to double check whether we publish the NPM packages installing only the prod dependencies and not the dev dependencies.

Steps to Reproduce

Install the library in your local env, and check the node_modules folder size:

du -sh *
139M	node_modules
436K	package-lock.json
4.0K	package.json

Environment

  • Powertools version used: latest
  • Packaging format (Layers, npm): NPM
  • AWS Lambda function runtime: all
  • Debugging logs: N/A

Related issues, RFCs

N/A

@saragerion saragerion added bug Something isn't working triage This item has not been triaged by a maintainer, please wait labels Jan 6, 2022
@saragerion
Copy link
Contributor Author

Thanks @michaelbrewer for the heads-up!

@saragerion saragerion added the logger This item relates to the Logger Utility label Jan 6, 2022
@saragerion saragerion self-assigned this Jan 6, 2022
@michaelbrewer
Copy link
Contributor

of coz we should see what size the packaged lambda is and how small we can make it.

@dreamorosi
Copy link
Contributor

Good point, we initially removed the whole lodash in favor of smaller packages as mentioned here, but somehow it got reintroduced, I think around the time when we had multiple eslint configs.

@dreamorosi dreamorosi added this to the production-ready-release milestone Jan 6, 2022
@saragerion saragerion linked a pull request Jan 6, 2022 that will close this issue
6 tasks
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2022

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@michaelbrewer
Copy link
Contributor

@saragerion there is also a lot of test resources in "commons" that we already have in shared. About 208k worth.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2022

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@michaelbrewer
Copy link
Contributor

I know this issue closed, but i assume for the production release there is plans to see how to minimize the size of the node_modules? Like how the aws-sdk-v3 is very lightweight: https://aws.amazon.com/blogs/developer/how-we-halved-the-publish-size-of-modular-aws-sdk-for-javascript-clients/

And for non-typescript users? should @types/aws-lambda always be included?

And maybe tips for the lambda layer:

@dreamorosi dreamorosi removed the triage This item has not been triaged by a maintainer, please wait label Oct 19, 2022
@dreamorosi dreamorosi added feature-request This item refers to a feature request for an existing or new utility completed This item is complete and has been merged/shipped and removed bug Something isn't working labels Nov 14, 2022
@dreamorosi dreamorosi changed the title Logger: reduce npm_modules size Feature request: reduce npm_modules size Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility logger This item relates to the Logger Utility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants