Uploading directly to Lambda has a size limit of 50MB.
This makes it difficult for Puppeteer, which is a very large library. Uploading your code to s3 and then updating your function from there increases this size limit to (I think) 250MB!
I use 7zip and typescript and here is my scripts that I use to upload to Lambda.
"scripts": {
"zip": "tsc && 7z a -r function.zip ./dist/* node_modules/",
"sendToLambda": "npm run zip && aws s3 cp function.zip s3://chrome-aws && aws lambda update-function-code --function-name puppeteer-on-lambda --s3-bucket chrome-aws --s3-key function.zip"
},
Looking for business leads?
Using the techniques talked about here at javascriptwebscrapingguy.com, we’ve been able to launch a way to access awesome web data. Learn more at Cobalt Intelligence!