HOWTO: Local Development
This project is compiled specifically for AWS Lambda (Linux x64)
Therefore the binary might not be compatible with your local system, making development trickier.
headless getter returns a boolean indicating if we are running on a serverless environment.
If it returns
false, it will cause the following side-effects:
argsgetter will return different flags
--single-processflag will be omitted
--start-maximizedflag with be present
defaultViewportgetter will return a different configuration
width=0(maximized) instead of
height=0(maximized) instead of
font()method becomes no-op to avoid polluting the user space
nulland Chromium / SwiftShader will not be extracted
It's possible to trick the
headless getter into returning
true by setting any of the following:
AWS_LAMBDA_FUNCTION_NAME(used by AWS Lambda)
FUNCTION_NAME(used by Google Cloud Functions)
FUNCTION_TARGET(used by Google Cloud Functions)
Additionally, to use the bundled
iltorb module, you need to be running Node 8.10 and set:
Note that this approach is not recommended, as it may not be compatible with your system.
On Node v10.16.0+, native Brotli is used instead, so the bundled
iltorb is no longer necessary.
The suggested workaround is to install
puppeteer as a development dependency.
npm install puppeteer-core chrome-aws-lambda --save-prod npm install puppeteer --save-dev
puppeteer getter will return the resolved
First it will try to load
puppeteer and, only if that's not available, fallback to loading
puppeteer-core - if
puppeteer-code is also not available, then a
MODULE_NOT_FOUND error is thrown.
As long as your deployment pipeline skips bundling
devDependencies, this approach allows us to rely on
puppeteer for local development and
puppeteer-core for production deployments.