What's next after creating Lambda Layer?
Closed this issue · 3 comments
Hi,
Is there any guide or tutorial on what to do next after successfully created this lambda layer?
I have included the layer ARN in my serverless framework configuration.
Do I still need to include chrome-aws-lambda and puppeteer-core in my package.json as dependency?
not sure about a good tutorial as i haven't gotten it working from layer yet.
you definitely don't need to include in lambda package,json.
Finally got this working. puppeteer-core is a dependency, chrome-aws-lambda is a dev-dependency. You'll need to put the layer arn in the template. Using this repo's published layer, I had to pin both of the aforementioned packages to v9.1.0.
Code to get the browser:
const browser = await chromium.puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless,
ignoreHTTPSErrors: true,
})
That's all it took for me.
Just follow the guide at https://github.com/Sparticuz/chrome-aws-lambda#usage but use this layer instead of adding an NPM package dependency