Skip to content

R-Gokul/serverless-html-to-pdf-puppeteer

Repository files navigation

Serverless Puppeteer using AWS Lambda Layers

Twitter: rafalwilinski

Recently AWS introduced Layers which enables sharing common code between functions and working with large dependencies (such as headless chrome) much easier.

Usage

It is very important to tell NPM to skip installing chromium from puppeteer package. To do so, installing dependencies should be done using this command:

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm install

or

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 yarn

Without this, your function size would be more than 200MB which is way too much.

After that, you can simply deploy your funciton.

sls deploy

curl <DEPLOYED_ENDPOINT>?address=https://google.com

or apply this ARN to your function directly: arn:aws:lambda:us-east-1:085108115628:layer:chrome:6

Bundling latest Chromium on your own

Prerequisites:

  • brotli
./download-latest.sh

About

serverless html to pdf puppeteer with layers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published