npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-chrome-ilkkah

v1.0.20

Published

Run headless Chrome, serverless-ly

Downloads

35

Readme

serverless-chrome

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 in serverless architectures and doing testing/CI, web-scraping, pre-rendering, etc.

CircleCI Coveralls Codacy grade David David GitHub release

Contents

  1. The Project
  2. Quick Start
  3. Examples
  4. Chrome Version
  5. Testing
  6. Known Issues / Limitations
  7. Roadmap
  8. Projects & Companies using serverless-chrome
  9. Change log
  10. Prior Art

The Project

This project contains:

Quick Start

Using AWS Lambda, the quickest way to get started is with the Serverless-framework CLI.

First, install serverless globally:

npm install serverless -g

Then pull down the example service:

serverless install -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:

serverless deploy

Further details are available in the Serverless Lambda example.

Examples

A collection of example functions for different providers and frameworks.

Serverless-framework

Chrome Version

The current Chrome build is:

  • Browser: HeadlessChrome/61.0.3135.0
  • Protocol-Version: 1.2
  • User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/61.0.3135.0 Safari/537.36
  • V8-Version: 6.1.201
  • WebKit-Version: 537.36 (@c671506faf285787f1c0377f90c8129a1a40a347)

Testing

Test with yarn test or just yarn ava to skip the linter.

Known Issues / Limitations

  1. Hack to Chrome code to disable /dev/shm. Details here.
  2. /tmp size on Lambda is only about 500MB.
  3. For steady/predictable loads, it might not be the most cost efficient to do this on Lambda vs. EC2

Roadmap

1.1

  1. Support for Google Cloud Functions
  2. Example for Apex
  3. Example for Claudia.js

1.2

  1. DOM manipulation and scraping example handler

Future

  1. Support for Azure Functions (Once Headless Chrome supports Windows)

Projects & Companies using serverless-chrome

Tell us about your project on the Wiki!

Change log

See the CHANGELOG

Prior Art

This project was inspired in various ways by the following projects: