Serverless Chrome contains everything you need to get started running headless Chrome on AWS Lambda (possibly Azure and GCP Functions soon).
The aim of this project is to provide the scaffolding for using Headless Chrome during a serverless function invocation. Serverless Chrome takes care of building and bundling the Chrome binaries and making sure Chrome is running when your serverless function executes. In addition, this project also provides a few example services for common patterns (e.g. taking a screenshot of a page, printing to PDF, some scraping, etc.)
Why? Because it's neat. It also opens up interesting possibilities for using the Chrome DevTools Protocol (and tools like Chromeless or Puppeteer) in serverless architectures and doing testing/CI, web-scraping, pre-rendering, etc.
"Bla bla bla! I just want to start coding!" No problem:
Using AWS Lambda, the quickest way to get started is with the Serverless-framework CLI.
First, install serverless
globally (npm install -g serverless
) and then:
serverless create -u https://github.com/adieuadieu/serverless-chrome/tree/master/examples/serverless-framework/aws
Then, you must configure your AWS credentials either by defining
AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
environmental variables, or
using an AWS profile. You can read more about this on the
Serverless Credentials Guide.
In short, either:
export AWS_PROFILE=<your-profile-name>
or
export AWS_ACCESS_KEY_ID=<your-key-here>
export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>
Then, to deploy the service and all of its functions:
npm run deploy
Further details are available in the Serverless Lambda example.
This project contains:
serverless-plugin-chrome
A collection of example functions for different providers and frameworks.
Serverless-framework Some simple functions for the Serverless-framework on AWS Lambda. It includes the following example functions:
Test with npm test
. Each package also contains it's own integration tests
which can be run with npm run test:integration
.
A collection of articles and tutorials written by others on using serverless-chrome
1.1
1.2
Future
Tell us about your project on the Wiki!
See the CHANGELOG
OMG. Yes. Plz, halp meeee.
This project was inspired in various ways by the following projects:
serverless-chrome © Marco Lüthy. Released under the MIT license.
Authored and maintained by Marco Lüthy with help from contributors.
github.com/adieuadieu · GitHub @adieuadieu · Twitter @adieuadieu · Medium @marco.luethy
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。