Starter Kit for running Headless-Chrome by Puppeteer on Aliyun Function computing.
It can use alone and also supported Serverless Framework.
$ git clone -o starter-kit https://github.com/muxiangqiu/puppeteer-fc-starter-kit.git your_project_name
FC's memory needs to be set to at least 512 MB, but the more memory, the better the performance of any operations.
tips: You can use fcli to deploy on FC, see fcli doc
By executing SLOWMO_MS=250 npm run local
, you can check the operation while actually viewing the chrome (non-headless, slowmo).
If you use alone, run npm run package
, and deploy the package.zip on FC .
Due to the large size of Chrome, it may exceed the Function computing package size limit (50MB) depending on the other module to include. In that case, put Chrome in OSS and download it at container startup so startup time will be longer.
Run npm run package-nochrome
, deploy the package.zip, and set following env valiables on Function computing.
CHROME_BUCKET
(required): OSS bucket where Chrome is putCHROME_REGION
(required): OSS region where Chrome is putCHROME_KEY
(optional): OSS key. default:headless_shell.tar.gz
This kit includes Chrome built by myself because official build Chrome installed by Puppeteer has problems about running on Function computing (missing shared library etc.).
If you want to use latest chrome, run chrome/buildChrome.sh on fcli sbox having at least 16GB memory and 30GB volume.
See also serverless-chrome.
Once you build it, link to headless_shell.tar.gz
in chrome
dir.