puppeteer: Unable to deploy Puppeteer - Unzipped size must be smaller than 262144000 bytes. - AWS Lambda
While deploying a function to AWS Lambda I am getting this error.
Unzipped size must be smaller than 262144000 bytes.
Dev Guide: AWS Lambda Limits
Is there any work-around for this?
Full deployment log
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (92.85 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
......
Serverless: Deployment failed!
Serverless Error ---------------------------------------
An error occurred while provisioning your stack: HelloLambdaFunction - Unzipped size must be smaller than 262144000 bytes.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: linux
Node Version: 6.11.2
Serverless Version: 1.20.2
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 11
- Comments: 31 (13 by maintainers)
I am using Puppeteer on Lambda, but I am not using official build Chrome downloaded by Puppeteer. That’s because official build has some problems about running on Lambda (couldn’t even launch for missing shared library).
So I decided to build it by myself same as serverless-chrome. As a result, it can be launched on Lambda. And due to smaller size (compressed 47 MB), it also can be included in the package.
Following includes built Chrome and minimum util scripts for starting Puppeteer on Lambda. https://github.com/sambaiz/puppeteer-lambda-starter-kit
Hi @kaushik-sundar. I’ve wrote this sample on how to do it
https://gist.github.com/homaily/a432af95e5c3e72d3a584d435544bee0
The only external dependency you need is AWS-SDK and it’s by default included in lambda functions.
The issue is that Chromium is being installed alongside Puppeteer and that ends up being quite large.
You can skip installing Chromium using:
npm i --ignore-scripts puppeteer
However, that’ll require you to figure out how to download Chrome yourself and run it with Puppeteer. I’ve never used AWS Lambda, so maybe others have suggestions.
anyone found the solution? I’m still struggling with it
Closing this since this comment explains how to launch on lambda.
@gebrits looks like chrome crashes. We’ll have a better support for this when the https://github.com/GoogleChrome/puppeteer/pull/960 lands.