Large package size when compiling for lambda
See original GitHub issueBug description
Hi There,
I’m looking at using Prisma in a lambda environment and have noticed the package size is around 250Mb
when using the following generator:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
I’m using the following package.json and am installing using npm ci --omit=dev
(have also tried npm ci --production
)
"devDependencies": {
"prisma": "^4.1.0",
"typescript": "~4.3.0"
},
"dependencies": {
"@prisma/client": "^4.1.0"
}
Wanted to check that this is the intended package size, and if it is, whether there are any files I can manually delete to minimise the package size.
I came across this article however we use AWS SAM and don’t want to introduce webpack solely to support prisma.
Thanks in advance for your help
How to reproduce
- Create an npm package with the above dependencies
- Use the prisma generator config above
- Run
npm ci --omit=dev
to install production dependencies - The
node_modules
package will be > 150Mb
Expected behavior
The node_modules
package is small enough (preferably < 30Mb) to deploy in a lambda function without using layers
Prisma information
Environment & setup
- OS: Mac OS
- Database: PostgreSQL
- Node.js version: 14.9
- npm: 8.14
Prisma Version
^4.1.0
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to increase the maximum size of the AWS lambda ...
You can load libraries or packages that are larger than the 250 MB package deployment size limit of AWS Lambda using EFS.
Read more >Reduce your package size when uploading a Lambda function
How to keep the package size you are uploading small? · removes all the devDependencies: npm install --production or even better (and faster!)...
Read more >Lambda deployment packages - AWS Documentation
Deployment packages over 50 MB. If your deployment package is larger than 50 MB, upload your function code and dependencies to an Amazon...
Read more >Minimizing AWS Lambda deployment package size in ...
At the time of writing of this article, deployment package size limits are 50 MB for zipped and 250 MB for unzipped functions...
Read more >AWS Lambda Limits to Keep in Mind When Developing a ...
There is a hard limit of 50MB for compressed deployment package with AWS Lambda and an uncompressed AWS Lambda hard limit of 250MB....
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 FreeTop 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
Top GitHub Comments
Today’s release 4.8.0 has significantly (average 50%, on some platforms even more) decreased the size of our engine files:
https://github.com/prisma/prisma/releases/tag/4.8.0
We know we still have duplicated engine files in multiple locations, and that we are including too many of our engine files - but this was the obvious place to start and we are happy how significantly we could improve the situation already. Expect more updates like this in the coming releases from us.
@cam-slyp If you are using AWS Lambda only, you could do the following
Note: In our docs we mention how to remove these unneeded artifacts but only when using the serveless framework, I think we could improve that and mention how to do that when using AWS Lambda alone.