0.0.7 • Published 8 years ago

phantomjs-lambda-pack v0.0.7

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

PhantomJS wrapper for AWS Lambda

Simplify the usage of PhantomJS on AWS Lambda

$ npm install phantomjs-lambda-pack --save

Usage

'use strict';
const phantomjsLambdaPack = require('phantomjs-lambda-pack');
const exec = phantomjsLambdaPack.exec;

exports.handler = (event, context, callback) => {
    exec('-v', (error, stdout, stderr) => {
        if (error) {
            console.error(`exec error: ${error}`);
            return;
        }

        console.log(`phantom version: ${stdout}`);
        console.log(`Should have no error: ${stderr}`);

        callback(error, 'fin!!');
    });
};

To Do

  1. Support phantomjs versioning, currently it just uses the latest of phatomjs-prebuilt
  2. Better support in the local environments, currently phantomjs needs to be installed in the path
  3. Check if the lambda memory requirements are met.

Notes

Use more memory at least 1024 and a timeout greater than 180 seconds Make sure to zip up the entire directory and ship it

Example

Basic Version Check using Serverless

Thanks

PhantomJS

AWS Lambda

PhantomJS-Prebuilt

Serverless