Package Exports
- @serverless-chrome/lambda
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@serverless-chrome/lambda) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
serverless-chrome/lambda
Standalone package to run Headless Chrome in AWS Lambda.
Contents
- Installation
- Setup
- Testing
- Configuration and Deployment
- Known Issues / Limitations
- Roadmap
- Troubleshooting
Installation
Install with yarn:
yarn add @serverless-chrome/lambdaInstall with npm:
npm install --save @serverless-chrome/lambdaSetup
Use in your AWS Lambda function. Requires Node 6.10.
todo: check that this code works:
const launchChrome = require('@serverless-chrome/lambda')
const CDP = require('chrome-remote-interface')
module.exports.handler = function handler (event, context, callback) {
launchChrome({
flags: ['--window-size=1280x1696', '--hide-scrollbars']
})
.then((chrome) => {
// Chrome is now running on localhost:9222
CDP.Version()
.then((versionInfo) => {
callback(null, {
versionInfo,
})
})
.catch((error) => {
callback(error)
})
})
.catch((error) => {
// Chrome didn't launch correctly
callback(error)
})
}