Unable to deploy AWS Lambda function due to huge size on dependencies
See original GitHub issueBug description
I have an AWS Lambda function. Unable to deploy it since I started working with Prisma. I have uninstalled both “prisma” and “@primsa/client” to see how much is the increase when installing.
node_modules before installing prisma as a devDependency: 65MB
node_modules after “yarn add prisma --dev”: 167MB
node_modules after “yarn add @prisma/client”: 338MB
This makes it impossible to deploy the Lambda function due to the 262144000 bytes maximum size allowed.
I am not using any framework. Just using a fresh AWS CDK project and inside the function folder package the following dependencies:
"dependencies": { "@prisma/client": "^2.21.2" }, "devDependencies": { "aws-sdk": "^2.826.0", "prisma": "^2.21.2" }
If you need any additional information I can provide it will be a pleasure to help.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:5 (3 by maintainers)
Top GitHub Comments
When deploying manually to Lambda, you need to make sure your archive only includes the necessary dependencies. (Development dependencies usually are not for example, many other are also not needed)
Here is an example script how we achieve that manually in our end to end tests:
https://github.com/prisma/e2e-tests/blob/dev/platforms-serverless/lambda/zip.sh
In the schema file of that project we have
binaryTargets = ["native", "rhel-openssl-1.0.x"]
. If necessary we could/would also remove thenative
binary before upload here (either by removing it from the schema before generation, or removing the files in the script).Does this work for you?
If you use something like Serverless Framework or deploy to Netlify or Vercel Functions, their tooling will take care of this automatically.
PS: We are missing documentation on how to typically do this for now - we will work on that in the future so your feedback will be super valuable here.
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.